Closed ClementVaillantCodit closed 3 months ago
Describe the bug When comparing unordered Json array of objects, the comparison fails even when using AssertJsonOrder.Ignore.
To Reproduce
string actual = "{\"Products\":[{\"id\":1},{\"id\":2},{\"id\":3}]}"; string expected = "{\"Products\":[{\"id\":3},{\"id\":2},{\"id\":1}]}"; EqualJson(expected, actual);
Comparison fails.
Please see: https://github.com/Codit/testing-framework/blob/main/src/Codit.Testing.OutputComparison/Helper/Json.cs#L62 Testing framework was handling this case.
Expected behavior Comparison must pass as array of objects have equal but unordered objects.
Additional context
This is actually expected, as they are objects and we can't determine the order of objects.
Describe the bug When comparing unordered Json array of objects, the comparison fails even when using AssertJsonOrder.Ignore.
To Reproduce
Comparison fails.
Please see: https://github.com/Codit/testing-framework/blob/main/src/Codit.Testing.OutputComparison/Helper/Json.cs#L62 Testing framework was handling this case.
Expected behavior Comparison must pass as array of objects have equal but unordered objects.
Additional context