File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,4 +56,22 @@ var expected = JToken.Parse(@"{ ""value"" : 1.4 }");
5656actual .Should ().BeEquivalentTo (expected , options => options
5757 .Using <double >(d => d .Subject .Should ().BeApproximately (d .Expectation , 0 . 1 ))
5858 .WhenTypeIs <double >());
59- ```
59+ ```
60+
61+ Also, there is ` WithoutStrictOrdering() ` which allows you to compare JSON arrays while ignoring the order of their elements.
62+ This is useful when the sequence of items is not important for your test scenario. When applied, assertions like ` BeEquivalentTo() ` will
63+ succeed as long as the arrays contain the same elements, regardless of their order.
64+
65+ Example:
66+
67+ ``` c#
68+ using FluentAssertions ;
69+ using FluentAssertions .Json ;
70+ using Newtonsoft .Json .Linq ;
71+
72+ .. .
73+ var actual = JToken .Parse (@" { "" array"" : [1, 2, 3] }" );
74+ var expected = JToken .Parse (@" { "" array"" : [3, 2, 1] }" );
75+ actual .Should ().BeEquivalentTo (expected , options => options
76+ .WithoutStrictOrdering ());
77+ ```
You can’t perform that action at this time.
0 commit comments