From 59377d3d734ab4970c2d1f30f552eb1dabc656f3 Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Tue, 20 Aug 2024 15:18:02 -0700 Subject: [PATCH] tests repaired --- .../Common/JsonComparer.cs | 33 +++++++++++++++++-- 1 file changed, 30 insertions(+), 3 deletions(-) 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; + } } } }