diff --git a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Common/JsonComparer.cs b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Common/JsonComparer.cs index de636fc45da..469007e5e36 100644 --- a/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Common/JsonComparer.cs +++ b/tools/test-proxy/Azure.Sdk.Tools.TestProxy/Common/JsonComparer.cs @@ -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; + } } } }