@@ -25,37 +25,37 @@ public AndConstraint<WireMockAssertions> WithBody(string body, string because =
25
25
}
26
26
27
27
[ CustomAssertion ]
28
- public AndConstraint < WireMockAssertions > WithBodyAsJson ( object body , string because = "" , params object [ ] becauseArgs )
28
+ public AndConstraint < WireMockAssertions > WithBody ( IStringMatcher matcher , string because = "" , params object [ ] becauseArgs )
29
29
{
30
- return WithBodyAsJson ( new JsonMatcher ( body ) , because , becauseArgs ) ;
30
+ var ( filter , condition ) = BuildFilterAndCondition ( r => r . Body , matcher ) ;
31
+
32
+ return ExecuteAssertionWithBodyStringMatcher ( matcher , because , becauseArgs , condition , filter , r => r . Body ) ;
31
33
}
32
34
33
35
[ CustomAssertion ]
34
- public AndConstraint < WireMockAssertions > WithBodyAsJson ( string body , string because = "" , params object [ ] becauseArgs )
36
+ public AndConstraint < WireMockAssertions > WithBodyAsJson ( object body , string because = "" , params object [ ] becauseArgs )
35
37
{
36
38
return WithBodyAsJson ( new JsonMatcher ( body ) , because , becauseArgs ) ;
37
39
}
38
40
39
41
[ CustomAssertion ]
40
- public AndConstraint < WireMockAssertions > WithBodyAsBytes ( byte [ ] body , string because = "" , params object [ ] becauseArgs )
42
+ public AndConstraint < WireMockAssertions > WithBodyAsJson ( string body , string because = "" , params object [ ] becauseArgs )
41
43
{
42
- return WithBodyAsBytes ( new ExactObjectMatcher ( body ) , because , becauseArgs ) ;
44
+ return WithBodyAsJson ( new JsonMatcher ( body ) , because , becauseArgs ) ;
43
45
}
44
46
45
47
[ CustomAssertion ]
46
- public AndConstraint < WireMockAssertions > WithBody ( IStringMatcher matcher , string because = "" , params object [ ] becauseArgs )
48
+ public AndConstraint < WireMockAssertions > WithBodyAsJson ( IObjectMatcher matcher , string because = "" , params object [ ] becauseArgs )
47
49
{
48
- var ( filter , condition ) = BuildFilterAndCondition ( r => r . Body , matcher ) ;
50
+ var ( filter , condition ) = BuildFilterAndCondition ( r => r . BodyAsJson , matcher ) ;
49
51
50
- return ExecuteAssertionWithBodyStringMatcher ( matcher , because , becauseArgs , condition , filter , r => r . Body ) ;
52
+ return ExecuteAssertionWithBodyAsIObjectMatcher ( matcher , because , becauseArgs , condition , filter , r => r . BodyAsJson ) ;
51
53
}
52
54
53
55
[ CustomAssertion ]
54
- public AndConstraint < WireMockAssertions > WithBodyAsJson ( IObjectMatcher matcher , string because = "" , params object [ ] becauseArgs )
56
+ public AndConstraint < WireMockAssertions > WithBodyAsBytes ( byte [ ] body , string because = "" , params object [ ] becauseArgs )
55
57
{
56
- var ( filter , condition ) = BuildFilterAndCondition ( r => r . BodyAsJson , matcher ) ;
57
-
58
- return ExecuteAssertionWithBodyAsIObjectMatcher ( matcher , because , becauseArgs , condition , filter , r => r . BodyAsJson ) ;
58
+ return WithBodyAsBytes ( new ExactObjectMatcher ( body ) , because , becauseArgs ) ;
59
59
}
60
60
61
61
[ CustomAssertion ]
@@ -142,6 +142,6 @@ private AndConstraint<WireMockAssertions> ExecuteAssertionWithBodyAsIObjectMatch
142
142
private static string ? FormatBodies ( IEnumerable < object ? > bodies )
143
143
{
144
144
var valueAsArray = bodies as object [ ] ?? bodies . ToArray ( ) ;
145
- return valueAsArray . Length == 1 ? FormatBody ( valueAsArray . First ( ) ) : $ "[ { string . Join ( ", " , valueAsArray . Select ( FormatBody ) ) } ]";
145
+ return valueAsArray . Length == 1 ? FormatBody ( valueAsArray [ 0 ] ) : $ "[ { string . Join ( ", " , valueAsArray . Select ( FormatBody ) ) } ]";
146
146
}
147
147
}
0 commit comments