Skip to content

Commit

Permalink
tests repaired
Browse files Browse the repository at this point in the history
  • Loading branch information
scbedd committed Aug 20, 2024
1 parent 2e33645 commit 59377d3
Showing 1 changed file with 30 additions and 3 deletions.
33 changes: 30 additions & 3 deletions tools/test-proxy/Azure.Sdk.Tools.TestProxy/Common/JsonComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,41 @@ private static void CompareElements(JsonElement element1, JsonElement element2,

break;
}
default:
case JsonValueKind.String:
{
if (element1.GetString() != element2.GetString())
{
differences.Add($"{path}: \"{element1.GetString()}\" != \"{element2.GetString()}\"");
}
break;
}
case JsonValueKind.Number:
{
if (element1.GetDecimal() != element2.GetDecimal())
{
differences.Add($"{path}: {element1.GetDecimal()} != {element2.GetDecimal()}");
}
break;
}
case JsonValueKind.True:
case JsonValueKind.False:
{
if (!element1.Equals(element2))
if (element1.GetBoolean() != element2.GetBoolean())
{
differences.Add($"{path}: {element1} != {element2}");
differences.Add($"{path}: {element1.GetBoolean()} != {element2.GetBoolean()}");
}
break;
}
case JsonValueKind.Null:
{
// Both are null, nothing to compare
break;
}
default:
{
differences.Add($"{path}: Unhandled value kind {element1.ValueKind}");
break;
}
}
}
}
Expand Down

0 comments on commit 59377d3

Please sign in to comment.