1
1
// Copyright © WireMock.Net
2
2
3
3
#pragma warning disable CS1591
4
- using System ;
4
+ using WireMock . Extensions ;
5
+ using WireMock . Matchers ;
5
6
6
7
// ReSharper disable once CheckNamespace
7
8
namespace WireMock . FluentAssertions ;
@@ -11,7 +12,17 @@ public partial class WireMockAssertions
11
12
[ CustomAssertion ]
12
13
public AndWhichConstraint < WireMockAssertions , string > AtAbsoluteUrl ( string absoluteUrl , string because = "" , params object [ ] becauseArgs )
13
14
{
14
- var ( filter , condition ) = BuildFilterAndCondition ( request => string . Equals ( request . AbsoluteUrl , absoluteUrl , StringComparison . OrdinalIgnoreCase ) ) ;
15
+ _ = AtAbsoluteUrl ( new ExactMatcher ( true , absoluteUrl ) , because , becauseArgs ) ;
16
+
17
+ return new AndWhichConstraint < WireMockAssertions , string > ( this , absoluteUrl ) ;
18
+ }
19
+
20
+ [ CustomAssertion ]
21
+ public AndWhichConstraint < WireMockAssertions , IStringMatcher > AtAbsoluteUrl ( IStringMatcher absoluteUrlMatcher , string because = "" , params object [ ] becauseArgs )
22
+ {
23
+ var ( filter , condition ) = BuildFilterAndCondition ( request => absoluteUrlMatcher . IsPerfectMatch ( request . AbsoluteUrl ) ) ;
24
+
25
+ var absoluteUrl = absoluteUrlMatcher . GetPatterns ( ) . FirstOrDefault ( ) . GetPattern ( ) ;
15
26
16
27
Execute . Assertion
17
28
. BecauseOf ( because , becauseArgs )
@@ -31,13 +42,23 @@ public AndWhichConstraint<WireMockAssertions, string> AtAbsoluteUrl(string absol
31
42
32
43
FilterRequestMessages ( filter ) ;
33
44
34
- return new AndWhichConstraint < WireMockAssertions , string > ( this , absoluteUrl ) ;
45
+ return new AndWhichConstraint < WireMockAssertions , IStringMatcher > ( this , absoluteUrlMatcher ) ;
35
46
}
36
47
37
48
[ CustomAssertion ]
38
49
public AndWhichConstraint < WireMockAssertions , string > AtUrl ( string url , string because = "" , params object [ ] becauseArgs )
39
50
{
40
- var ( filter , condition ) = BuildFilterAndCondition ( request => string . Equals ( request . Url , url , StringComparison . OrdinalIgnoreCase ) ) ;
51
+ _ = AtUrl ( new ExactMatcher ( true , url ) , because , becauseArgs ) ;
52
+
53
+ return new AndWhichConstraint < WireMockAssertions , string > ( this , url ) ;
54
+ }
55
+
56
+ [ CustomAssertion ]
57
+ public AndWhichConstraint < WireMockAssertions , IStringMatcher > AtUrl ( IStringMatcher urlMatcher , string because = "" , params object [ ] becauseArgs )
58
+ {
59
+ var ( filter , condition ) = BuildFilterAndCondition ( request => urlMatcher . IsPerfectMatch ( request . Url ) ) ;
60
+
61
+ var url = urlMatcher . GetPatterns ( ) . FirstOrDefault ( ) . GetPattern ( ) ;
41
62
42
63
Execute . Assertion
43
64
. BecauseOf ( because , becauseArgs )
@@ -57,6 +78,6 @@ public AndWhichConstraint<WireMockAssertions, string> AtUrl(string url, string b
57
78
58
79
FilterRequestMessages ( filter ) ;
59
80
60
- return new AndWhichConstraint < WireMockAssertions , string > ( this , url ) ;
81
+ return new AndWhichConstraint < WireMockAssertions , IStringMatcher > ( this , urlMatcher ) ;
61
82
}
62
83
}
0 commit comments