@@ -9,61 +9,61 @@ namespace FluentAssertions.Json.Specs
99 public class WithoutStrictOrderingSpecs
1010 {
1111 [ Theory ]
12- [ MemberData ( nameof ( Should_HandleJToken_WhenNeedToIgnoreOrdering_SampleData ) ) ]
13- public void Should_HandleJToken_WhenNeedToIgnoreOrdering ( string json1 , string json2 )
12+ [ MemberData ( nameof ( When_ignoring_ordering_BeEquivalentTo_should_succeed_sample_data ) ) ]
13+ public void When_ignoring_ordering_BeEquivalentTo_should_succeed ( string subject , string expectation )
1414 {
1515 // Arrange
16- var j1 = JToken . Parse ( json1 ) ;
17- var j2 = JToken . Parse ( json2 ) ;
16+ var subjectJToken = JToken . Parse ( subject ) ;
17+ var expectationJToken = JToken . Parse ( expectation ) ;
1818
1919 // Act
20- j1 . Should ( ) . BeEquivalentTo ( j2 , opt => opt . WithoutStrictOrdering ( ) ) ;
20+ subjectJToken . Should ( ) . BeEquivalentTo ( expectationJToken , opt => opt . WithoutStrictOrdering ( ) ) ;
2121
2222 // Assert
2323 }
2424
25- [ Theory ]
26- [ MemberData ( nameof ( Should_DoNotHandleJToken_WhenNoNeedToIgnoreOrdering_SampleData ) ) ]
27- public void Should_DoNotHandleJToken_WhenNoNeedToIgnoreOrdering ( string json1 , string json2 )
28- {
29- // Arrange
30- var j1 = JToken . Parse ( json1 ) ;
31- var j2 = JToken . Parse ( json2 ) ;
32-
33- // Act
34- var action = new Func < AndConstraint < JTokenAssertions > > ( ( ) => j1 . Should ( ) . BeEquivalentTo ( j2 ) ) ;
35-
36- // Assert
37- action . Should ( ) . Throw < XunitException > ( ) ;
38- }
39-
40- public static IEnumerable < object [ ] > Should_DoNotHandleJToken_WhenNoNeedToIgnoreOrdering_SampleData ( )
25+ public static IEnumerable < object [ ] > When_ignoring_ordering_BeEquivalentTo_should_succeed_sample_data ( )
4126 {
4227 yield return new object [ ] { @"{""ids"":[1,2,3]}" , @"{""ids"":[3,2,1]}" } ;
28+ yield return new object [ ] { @"{""ids"":[1,2,3]}" , @"{""ids"":[1,2,3]}" } ;
29+ yield return new object [ ] { @"{""type"":2,""name"":""b""}" , @"{""name"":""b"",""type"":2}" } ;
4330 yield return new object [ ] { @"{""names"":[""a"",""b""]}" , @"{""names"":[""b"",""a""]}" } ;
4431 yield return new object [ ]
4532 {
4633 @"{""vals"":[{""type"":1,""name"":""a""},{""name"":""b"",""type"":2}]}" ,
4734 @"{""vals"":[{""type"":2,""name"":""b""},{""name"":""a"",""type"":1}]}"
4835 } ;
36+ yield return new object [ ]
37+ {
38+ @"{""vals"":[{""type"":1,""name"":""a""},{""name"":""b"",""type"":2}]}" ,
39+ @"{""vals"":[{""name"":""a"",""type"":1},{""type"":2,""name"":""b""}]}"
40+ } ;
4941 }
5042
51- public static IEnumerable < object [ ] > Should_HandleJToken_WhenNeedToIgnoreOrdering_SampleData ( )
43+ [ Theory ]
44+ [ MemberData ( nameof ( When_not_ignoring_ordering_BeEquivalentTo_should_throw_sample_data ) ) ]
45+ public void When_not_ignoring_ordering_BeEquivalentTo_should_throw ( string subject , string expectation )
46+ {
47+ // Arrange
48+ var subjectJToken = JToken . Parse ( subject ) ;
49+ var expectationJToken = JToken . Parse ( expectation ) ;
50+
51+ // Act
52+ var action = new Func < AndConstraint < JTokenAssertions > > ( ( ) => subjectJToken . Should ( ) . BeEquivalentTo ( expectationJToken ) ) ;
53+
54+ // Assert
55+ action . Should ( ) . Throw < XunitException > ( ) ;
56+ }
57+
58+ public static IEnumerable < object [ ] > When_not_ignoring_ordering_BeEquivalentTo_should_throw_sample_data ( )
5259 {
5360 yield return new object [ ] { @"{""ids"":[1,2,3]}" , @"{""ids"":[3,2,1]}" } ;
54- yield return new object [ ] { @"{""ids"":[1,2,3]}" , @"{""ids"":[1,2,3]}" } ;
55- yield return new object [ ] { @"{""type"":2,""name"":""b""}" , @"{""name"":""b"",""type"":2}" } ;
5661 yield return new object [ ] { @"{""names"":[""a"",""b""]}" , @"{""names"":[""b"",""a""]}" } ;
5762 yield return new object [ ]
5863 {
5964 @"{""vals"":[{""type"":1,""name"":""a""},{""name"":""b"",""type"":2}]}" ,
6065 @"{""vals"":[{""type"":2,""name"":""b""},{""name"":""a"",""type"":1}]}"
6166 } ;
62- yield return new object [ ]
63- {
64- @"{""vals"":[{""type"":1,""name"":""a""},{""name"":""b"",""type"":2}]}" ,
65- @"{""vals"":[{""name"":""a"",""type"":1},{""type"":2,""name"":""b""}]}"
66- } ;
6767 }
6868 }
6969}
0 commit comments