-
Notifications
You must be signed in to change notification settings - Fork 30
Added the option to ignore the order in arrays and collections #80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added the option to ignore the order in arrays and collections #80
Conversation
Pull Request Test Coverage Report for Build 18630461237Details
💛 - Coveralls |
dennisdoomen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⛏️ Would be nice to add small paragraph to the readme to mention this new option
| JObject obj => new JObject(obj.Properties().OrderBy(p => p.Name).Select(p => new JProperty(p.Name, Normalize(p.Value)))), | ||
| JArray array => new JArray(array.Select(Normalize).OrderBy(x => x.ToString(Newtonsoft.Json.Formatting.None))), | ||
| _ => token |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⛏️ (nitpick) I would prefer to have this spelled out instead of a switch statement for readability
Summary
This merge request introduces the
WithoutStrictOrderingmethod to theIJsonAssertionOptions<T>interface. This method allows users to configure JSON assertions to ignore the order of elements in arrays or collections during comparison, enabling equivalency checks regardless of element sequence.Changes
WithoutStrictOrdering()toIJsonAssertionOptions<T>.Motivation
The addition of
WithoutStrictOrderingprovides greater flexibility in JSON assertions by allowing tests to pass even when the order of array or collection elements differs between the subject and expectation.Impact