Update MappingConverter to correctly write the Matcher as C# code (#1152)

* Update MappingConverter to correctly write the Matcher as C# code

* .

* CSharpCodeMatcher

* tests

* .
This commit is contained in:
Stef Heyenrath
2024-08-27 19:38:07 +02:00
committed by GitHub
parent 95573eeb96
commit da100298c1
41 changed files with 709 additions and 158 deletions

View File

@@ -47,6 +47,7 @@ message HelloReply {
.WithPath("/grpc/greet.Greeter/SayHello")
.WithBodyAsProtoBuf(ProtoDefinition, "greet.HelloRequest", protoBufJsonMatcher)
)
.WithGuid(_guidUtilsMock.Object.NewGuid())
.RespondWith(Response.Create()
.WithHeader("Content-Type", "application/grpc")
.WithBodyAsProtoBuf(ProtoDefinition, "greet.HelloReply",
@@ -66,6 +67,7 @@ message HelloReply {
.WithBodyAsProtoBuf("greet.HelloRequest", protoBufJsonMatcher)
)
.WithProtoDefinition(ProtoDefinition)
.WithGuid(_guidUtilsMock.Object.NewGuid())
.RespondWith(Response.Create()
.WithHeader("Content-Type", "application/grpc")
.WithBodyAsProtoBuf("greet.HelloReply",
@@ -86,6 +88,7 @@ message HelloReply {
.WithBodyAsProtoBuf("greet.HelloRequest", protoBufJsonMatcher)
)
.WithProtoDefinition("my-greeter")
.WithGuid(_guidUtilsMock.Object.NewGuid())
.RespondWith(Response.Create()
.WithHeader("Content-Type", "application/grpc")
.WithBodyAsProtoBuf("greet.HelloReply",
@@ -106,6 +109,7 @@ message HelloReply {
.WithBodyAsProtoBuf("greet.HelloRequest")
)
.WithProtoDefinition("my-greeter")
.WithGuid(_guidUtilsMock.Object.NewGuid())
.RespondWith(Response.Create()
.WithHeader("Content-Type", "application/grpc")
.WithBodyAsProtoBuf("greet.HelloReply",

View File

@@ -2,8 +2,8 @@
server
.Given(Request.Create()
.UsingMethod("GET")
.WithPath("/foo1")
.WithParam("p1", "xyz")
.WithPath(new WildcardMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, "/foo1", false, WireMock.Matchers.MatchOperator.Or))
.WithParam("p1", new ExactMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, false, WireMock.Matchers.MatchOperator.And, "xyz"))
)
.WithGuid("90356dba-b36c-469a-a17e-669cd84f1f05")
.RespondWith(Response.Create()

View File

@@ -2,25 +2,7 @@
server
.Given(Request.Create()
.UsingMethod("POST")
.WithPath("/users/post1")
.WithBody(new JsonMatcher(
value: new
{
city = "Amsterdam",
country = "The Netherlands"
},
ignoreCase: false,
regex: false
))
)
.WithGuid("90356dba-b36c-469a-a17e-669cd84f1f05")
.RespondWith(Response.Create()
);
server
.Given(Request.Create()
.UsingMethod("POST")
.WithPath("/users/post2")
.WithPath(new WildcardMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, "/users/post2", false, WireMock.Matchers.MatchOperator.Or))
.WithBody(new JsonPartialMatcher(
value: new
{
@@ -37,23 +19,11 @@ server
Some ""value"" in Line2")
);
server
.Given(Request.Create()
.UsingMethod("GET")
.WithPath("/foo1")
.WithParam("p1", "xyz")
)
.WithGuid("f74fd144-df53-404f-8e35-da22a640bd5f")
.RespondWith(Response.Create()
.WithStatusCode(200)
.WithBody("1")
);
server
.Given(Request.Create()
.UsingMethod("POST")
.WithPath("/foo2")
.WithParam("p2", "abc")
.WithPath(new WildcardMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, "/foo2", false, WireMock.Matchers.MatchOperator.Or))
.WithParam("p2", new ExactMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, false, WireMock.Matchers.MatchOperator.And, "abc"))
.WithHeader("h1", "W/\"234f2q3r\"", true)
)
.WithGuid("4126dec8-470b-4eff-93bb-c24f83b8b1fd")
@@ -64,10 +34,28 @@ server
.WithBody("2")
);
server
.Given(Request.Create()
.UsingMethod("POST")
.WithPath(new WildcardMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, "/users/post1", false, WireMock.Matchers.MatchOperator.Or))
.WithBody(new JsonMatcher(
value: new
{
city = "Amsterdam",
country = "The Netherlands"
},
ignoreCase: false,
regex: false
))
)
.WithGuid("90356dba-b36c-469a-a17e-669cd84f1f05")
.RespondWith(Response.Create()
);
server
.Given(Request.Create()
.UsingMethod("DELETE")
.WithUrl("https://localhost/test")
.WithUrl(new WildcardMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, "https://localhost/test", false, WireMock.Matchers.MatchOperator.Or))
)
.WithGuid("c9929240-7ae8-4a5d-8ed8-0913479f6eeb")
.RespondWith(Response.Create()
@@ -108,3 +96,15 @@ text
})
);
server
.Given(Request.Create()
.UsingMethod("GET")
.WithPath(new WildcardMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, "/foo1", false, WireMock.Matchers.MatchOperator.Or))
.WithParam("p1", new ExactMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, false, WireMock.Matchers.MatchOperator.And, "xyz"))
)
.WithGuid("f74fd144-df53-404f-8e35-da22a640bd5f")
.RespondWith(Response.Create()
.WithStatusCode(200)
.WithBody("1")
);

View File

@@ -30,6 +30,7 @@ using WireMock.ResponseBuilders;
using WireMock.Server;
using WireMock.Settings;
using WireMock.Types;
using WireMock.Util;
using Xunit;
namespace WireMock.Net.Tests.AdminApi;
@@ -39,6 +40,14 @@ public partial class WireMockAdminApiTests
{
private static readonly VerifySettings VerifySettings = new();
private readonly Mock<IGuidUtils> _guidUtilsMock = new();
public WireMockAdminApiTests()
{
var startGuid = 1000;
_guidUtilsMock.Setup(g => g.NewGuid()).Returns(() => new Guid($"98fae52e-76df-47d9-876f-2ee32e93{startGuid++}"));
}
static WireMockAdminApiTests()
{
VerifyNewtonsoftJson.Enable(VerifySettings);

View File

@@ -32,6 +32,35 @@
Body: { msg: "Hello world!"}
}
},
{
Guid: 98fae52e-76df-47d9-876f-2ee32e931001,
UpdatedAt: 2023-01-14 15:16:17,
Request: {
Path: {
Matchers: [
{
Name: WildcardMatcher,
Pattern: /users/post1,
IgnoreCase: false
}
]
},
Methods: [
POST
],
Body: {
Matcher: {
Name: JsonMatcher,
Pattern: {
Request: Hello?
},
IgnoreCase: false,
Regex: false
}
}
},
Response: {}
},
{
Guid: 98fae52e-76df-47d9-876f-2ee32e931002,
UpdatedAt: 2023-01-14 15:16:17,
@@ -106,31 +135,33 @@
Response: {}
},
{
Guid: 98fae52e-76df-47d9-876f-2ee32e931001,
Guid: 98fae52e-76df-47d9-876f-2ee32e931004,
UpdatedAt: 2023-01-14 15:16:17,
Request: {
Path: {
Matchers: [
{
Name: WildcardMatcher,
Pattern: /users/post1,
Pattern: /regex,
IgnoreCase: false
}
]
},
Methods: [
POST
GET
],
Body: {
Matcher: {
Name: JsonMatcher,
Pattern: {
Request: Hello?
},
IgnoreCase: false,
Regex: false
Params: [
{
Name: foo,
Matchers: [
{
Name: RegexMatcher,
Pattern: .*,
IgnoreCase: false
}
]
}
}
]
},
Response: {}
}

View File

@@ -2,8 +2,8 @@
builder
.Given(Request.Create()
.UsingMethod("GET")
.WithPath("/foo")
.WithParam("test", "it.Length < 10")
.WithPath(new WildcardMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, "/foo", false, WireMock.Matchers.MatchOperator.Or))
.WithParam("test", new LinqMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, WireMock.Matchers.MatchOperator.Or, "it.Length < 10"))
)
.WithGuid("41372914-1838-4c67-916b-b9aacdd096ce")
.RespondWith(Response.Create()
@@ -13,7 +13,24 @@ builder
builder
.Given(Request.Create()
.UsingMethod("POST")
.WithPath("/users/post2")
.WithPath(new WildcardMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, "/users/post1", false, WireMock.Matchers.MatchOperator.Or))
.WithBody(new JsonMatcher(
value: new
{
Request = "Hello?"
},
ignoreCase: false,
regex: false
))
)
.WithGuid("98fae52e-76df-47d9-876f-2ee32e931001")
.RespondWith(Response.Create()
);
builder
.Given(Request.Create()
.UsingMethod("POST")
.WithPath(new WildcardMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, "/users/post2", false, WireMock.Matchers.MatchOperator.Or))
.WithBody(new JsonMatcher(
value: new
{
@@ -31,7 +48,7 @@ builder
builder
.Given(Request.Create()
.UsingMethod("POST")
.WithPath("/form-urlencoded")
.WithPath(new WildcardMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, "/form-urlencoded", false, WireMock.Matchers.MatchOperator.Or))
.WithHeader("Content-Type", "application/x-www-form-urlencoded", true)
.WithBody("name=John Doe")
)
@@ -41,18 +58,11 @@ builder
builder
.Given(Request.Create()
.UsingMethod("POST")
.WithPath("/users/post1")
.WithBody(new JsonMatcher(
value: new
{
Request = "Hello?"
},
ignoreCase: false,
regex: false
))
.UsingMethod("GET")
.WithPath(new WildcardMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, "/regex", false, WireMock.Matchers.MatchOperator.Or))
.WithParam("foo", new RegexMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, ".*", false, true, WireMock.Matchers.MatchOperator.Or))
)
.WithGuid("98fae52e-76df-47d9-876f-2ee32e931001")
.WithGuid("98fae52e-76df-47d9-876f-2ee32e931004")
.RespondWith(Response.Create()
);

View File

@@ -2,8 +2,8 @@
server
.Given(Request.Create()
.UsingMethod("GET")
.WithPath("/foo")
.WithParam("test", "it.Length < 10")
.WithPath(new WildcardMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, "/foo", false, WireMock.Matchers.MatchOperator.Or))
.WithParam("test", new LinqMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, WireMock.Matchers.MatchOperator.Or, "it.Length < 10"))
)
.WithGuid("41372914-1838-4c67-916b-b9aacdd096ce")
.RespondWith(Response.Create()
@@ -13,7 +13,24 @@ server
server
.Given(Request.Create()
.UsingMethod("POST")
.WithPath("/users/post2")
.WithPath(new WildcardMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, "/users/post1", false, WireMock.Matchers.MatchOperator.Or))
.WithBody(new JsonMatcher(
value: new
{
Request = "Hello?"
},
ignoreCase: false,
regex: false
))
)
.WithGuid("98fae52e-76df-47d9-876f-2ee32e931001")
.RespondWith(Response.Create()
);
server
.Given(Request.Create()
.UsingMethod("POST")
.WithPath(new WildcardMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, "/users/post2", false, WireMock.Matchers.MatchOperator.Or))
.WithBody(new JsonMatcher(
value: new
{
@@ -31,7 +48,7 @@ server
server
.Given(Request.Create()
.UsingMethod("POST")
.WithPath("/form-urlencoded")
.WithPath(new WildcardMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, "/form-urlencoded", false, WireMock.Matchers.MatchOperator.Or))
.WithHeader("Content-Type", "application/x-www-form-urlencoded", true)
.WithBody("name=John Doe")
)
@@ -41,18 +58,11 @@ server
server
.Given(Request.Create()
.UsingMethod("POST")
.WithPath("/users/post1")
.WithBody(new JsonMatcher(
value: new
{
Request = "Hello?"
},
ignoreCase: false,
regex: false
))
.UsingMethod("GET")
.WithPath(new WildcardMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, "/regex", false, WireMock.Matchers.MatchOperator.Or))
.WithParam("foo", new RegexMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, ".*", false, true, WireMock.Matchers.MatchOperator.Or))
)
.WithGuid("98fae52e-76df-47d9-876f-2ee32e931001")
.WithGuid("98fae52e-76df-47d9-876f-2ee32e931004")
.RespondWith(Response.Create()
);

View File

@@ -32,6 +32,34 @@
Body: { msg: "Hello world!"}
}
},
{
Guid: 98fae52e-76df-47d9-876f-2ee32e931001,
UpdatedAt: 2023-01-14T15:16:17,
Request: {
Path: {
Matchers: [
{
Name: WildcardMatcher,
Pattern: /users/post1,
IgnoreCase: false
}
]
},
Methods: [
POST
],
Body: {
Matcher: {
Name: JsonMatcher,
Pattern: {
Request: Hello?
},
IgnoreCase: false,
Regex: false
}
}
}
},
{
Guid: 98fae52e-76df-47d9-876f-2ee32e931002,
UpdatedAt: 2023-01-14T15:16:17,
@@ -104,31 +132,33 @@
}
},
{
Guid: 98fae52e-76df-47d9-876f-2ee32e931001,
Guid: 98fae52e-76df-47d9-876f-2ee32e931004,
UpdatedAt: 2023-01-14T15:16:17,
Request: {
Path: {
Matchers: [
{
Name: WildcardMatcher,
Pattern: /users/post1,
Pattern: /regex,
IgnoreCase: false
}
]
},
Methods: [
POST
GET
],
Body: {
Matcher: {
Name: JsonMatcher,
Pattern: {
Request: Hello?
},
IgnoreCase: false,
Regex: false
Params: [
{
Name: foo,
Matchers: [
{
Name: RegexMatcher,
Pattern: .*,
IgnoreCase: false
}
]
}
}
]
}
}
]

View File

@@ -102,6 +102,13 @@ public class MappingBuilderTests
.WithHeader("Content-Type", "application/x-www-form-urlencoded")
.WithBody(new FormUrlEncodedMatcher(["name=John Doe", "email=johndoe@example.com"]))
).RespondWith(Response.Create());
_sut.Given(Request.Create()
.WithPath("/regex")
.WithParam("foo", new RegexMatcher(".*"))
.UsingGet()
)
.RespondWith(Response.Create());
}
[Fact]
@@ -190,9 +197,9 @@ public class MappingBuilderTests
_sut.SaveMappingsToFolder(null);
// Verify
_fileSystemHandlerMock.Verify(fs => fs.GetMappingFolder(), Times.Exactly(4));
_fileSystemHandlerMock.Verify(fs => fs.FolderExists(mappingFolder), Times.Exactly(4));
_fileSystemHandlerMock.Verify(fs => fs.WriteMappingFile(It.IsAny<string>(), It.IsAny<string>()), Times.Exactly(4));
_fileSystemHandlerMock.Verify(fs => fs.GetMappingFolder(), Times.Exactly(5));
_fileSystemHandlerMock.Verify(fs => fs.FolderExists(mappingFolder), Times.Exactly(5));
_fileSystemHandlerMock.Verify(fs => fs.WriteMappingFile(It.IsAny<string>(), It.IsAny<string>()), Times.Exactly(5));
_fileSystemHandlerMock.VerifyNoOtherCalls();
}
@@ -208,8 +215,8 @@ public class MappingBuilderTests
// Verify
_fileSystemHandlerMock.Verify(fs => fs.GetMappingFolder(), Times.Never);
_fileSystemHandlerMock.Verify(fs => fs.FolderExists(path), Times.Exactly(4));
_fileSystemHandlerMock.Verify(fs => fs.WriteMappingFile(It.IsAny<string>(), It.IsAny<string>()), Times.Exactly(4));
_fileSystemHandlerMock.Verify(fs => fs.FolderExists(path), Times.Exactly(5));
_fileSystemHandlerMock.Verify(fs => fs.WriteMappingFile(It.IsAny<string>(), It.IsAny<string>()), Times.Exactly(5));
_fileSystemHandlerMock.VerifyNoOtherCalls();
}
}

View File

@@ -29,7 +29,7 @@ public class ExactObjectMatcherTests
object checkValue = new byte[] { 1, 2 };
// Act
var matcher = new ExactObjectMatcher(new byte[] { 1, 2 });
var matcher = new ExactObjectMatcher([1, 2]);
var score = matcher.IsMatch(checkValue).Score;
// Assert

View File

@@ -0,0 +1,177 @@
using FluentAssertions;
using WireMock.Matchers;
using Xunit;
namespace WireMock.Net.Tests.Matchers;
public class MatcherTests
{
[Fact]
public void ContentTypeMatcher_GetCSharpCodeArguments_ShouldReturnCorrectArguments()
{
// Arrange
var matcher = new ContentTypeMatcher("application/json");
// Act
var result = matcher.GetCSharpCodeArguments();
// Assert
result.Should().Be("new ContentTypeMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, \"application/json\", false)");
}
[Fact]
public void ExactMatcher_GetCSharpCodeArguments_ShouldReturnCorrectArguments()
{
// Arrange
var matcher = new ExactMatcher("test");
// Act
var result = matcher.GetCSharpCodeArguments();
// Assert
result.Should().Be("new ExactMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, false, WireMock.Matchers.MatchOperator.Or, \"test\")");
}
[Fact]
public void ExactObjectMatcher_GetCSharpCodeArguments_ShouldReturnNotImplemented()
{
// Arrange
var matcher = new ExactObjectMatcher(new { Name = "test" });
// Act
var result = matcher.GetCSharpCodeArguments();
// Assert
result.Should().Be("NotImplemented");
}
[Fact]
public void FormUrlEncodedMatcher_GetCSharpCodeArguments_ShouldReturnCorrectArguments()
{
// Arrange
var matcher = new FormUrlEncodedMatcher("key=value");
// Act
var result = matcher.GetCSharpCodeArguments();
// Assert
result.Should().Be("new FormUrlEncodedMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, \"key=value\", false, WireMock.Matchers.MatchOperator.Or)");
}
[Fact]
public void JmesPathMatcher_GetCSharpCodeArguments_ShouldReturnCorrectArguments()
{
// Arrange
var matcher = new JmesPathMatcher("expression");
// Act
var result = matcher.GetCSharpCodeArguments();
// Assert
result.Should().Be("new JmesPathMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, WireMock.Matchers.MatchOperator.Or, \"expression\")");
}
[Fact]
public void JsonMatcher_GetCSharpCodeArguments_ShouldReturnCorrectArguments()
{
// Arrange
var matcher = new JsonMatcher(new { key = "value" });
// Act
var result = matcher.GetCSharpCodeArguments();
// Assert
result.Should().StartWith("new JsonMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch,");
}
[Fact]
public void JsonPartialMatcher_GetCSharpCodeArguments_ShouldReturnCorrectArguments()
{
// Arrange
var matcher = new JsonPartialMatcher(new { key = "value" });
// Act
var result = matcher.GetCSharpCodeArguments();
// Assert
result.Should().StartWith("new JsonPartialMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch,");
}
[Fact]
public void JsonPartialWildcardMatcher_GetCSharpCodeArguments_ShouldReturnCorrectArguments()
{
// Arrange
var matcher = new JsonPartialWildcardMatcher(new { key = "value" });
// Act
var result = matcher.GetCSharpCodeArguments();
// Assert
result.Should().StartWith("new JsonPartialWildcardMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch,");
}
[Fact]
public void LinqMatcher_GetCSharpCodeArguments_ShouldReturnCorrectArguments()
{
// Arrange
var matcher = new LinqMatcher("it.Contains(\"test\"");
// Act
var result = matcher.GetCSharpCodeArguments();
// Assert
result.Should().Be("new LinqMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, WireMock.Matchers.MatchOperator.Or, \"it.Contains(\\\"test\\\"\")");
}
[Fact]
public void RegexMatcher_GetCSharpCodeArguments_ShouldReturnCorrectArguments()
{
// Arrange
var matcher = new RegexMatcher("pattern");
// Act
var result = matcher.GetCSharpCodeArguments();
// Assert
result.Should().Be("new RegexMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, \"pattern\", false, true, WireMock.Matchers.MatchOperator.Or)");
}
[Fact]
public void SimMetricsMatcher_GetCSharpCodeArguments_ShouldReturnCorrectArguments()
{
// Arrange
var matcher = new SimMetricsMatcher("test");
// Act
var result = matcher.GetCSharpCodeArguments();
// Assert
result.Should().Be("new SimMetricsMatcher.Levenstein(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, \"test\", SimMetrics.Net.SimMetricType.Levenstein, WireMock.Matchers.MatchOperator.Average)");
}
[Fact]
public void WildcardMatcher_GetCSharpCodeArguments_ShouldReturnCorrectArguments()
{
// Arrange
var matcher = new WildcardMatcher("pattern");
// Act
var result = matcher.GetCSharpCodeArguments();
// Assert
result.Should().Be("new WildcardMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, \"pattern\", false, WireMock.Matchers.MatchOperator.Or)");
}
[Fact]
public void XPathMatcher_GetCSharpCodeArguments_ShouldReturnCorrectArguments()
{
// Arrange
var matcher = new XPathMatcher("pattern1");
// Act
var result = matcher.GetCSharpCodeArguments();
// Assert
result.Should().Be("new XPathMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, WireMock.Matchers.MatchOperator.Or, null, \"pattern1\")");
}
}

View File

@@ -92,11 +92,17 @@ public class CustomPathParamMatcher : IStringMatcher
public MatchOperator MatchOperator { get; }
/// <inheritdoc />
public string GetCSharpCodeArguments()
{
return "// TODO: CustomPathParamMatcher";
}
private static string[] GetPathParts(string? path)
{
if (path is null)
{
return new string[0];
return [];
}
var hashMarkIndex = path.IndexOf('#');

View File

@@ -1,8 +1,8 @@
builder
.Given(Request.Create()
.UsingMethod("GET")
.WithPath("test_path")
.WithParam("q", "42")
.WithPath(new WildcardMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, "test_path", false, WireMock.Matchers.MatchOperator.Or))
.WithParam("q", new ExactMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, false, WireMock.Matchers.MatchOperator.And, "42"))
.WithClientIP("112.123.100.99")
.WithHeader("h-key", "h-value", true)
.WithCookie("c-key", "c-value", true)

View File

@@ -2,8 +2,8 @@
builder
.Given(Request.Create()
.UsingMethod("GET")
.WithPath("test_path")
.WithParam("q", "42")
.WithPath(new WildcardMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, "test_path", false, WireMock.Matchers.MatchOperator.Or))
.WithParam("q", new ExactMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, false, WireMock.Matchers.MatchOperator.And, "42"))
.WithClientIP("112.123.100.99")
.WithHeader("h-key", "h-value", true)
.WithCookie("c-key", "c-value", true)

View File

@@ -1,8 +1,8 @@
server
.Given(Request.Create()
.UsingMethod("GET")
.WithPath("test_path")
.WithParam("q", "42")
.WithPath(new WildcardMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, "test_path", false, WireMock.Matchers.MatchOperator.Or))
.WithParam("q", new ExactMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, false, WireMock.Matchers.MatchOperator.And, "42"))
.WithClientIP("112.123.100.99")
.WithHeader("h-key", "h-value", true)
.WithCookie("c-key", "c-value", true)

View File

@@ -2,8 +2,8 @@
server
.Given(Request.Create()
.UsingMethod("GET")
.WithPath("test_path")
.WithParam("q", "42")
.WithPath(new WildcardMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, "test_path", false, WireMock.Matchers.MatchOperator.Or))
.WithParam("q", new ExactMatcher(WireMock.Matchers.MatchBehaviour.AcceptOnMatch, false, WireMock.Matchers.MatchOperator.And, "42"))
.WithClientIP("112.123.100.99")
.WithHeader("h-key", "h-value", true)
.WithCookie("c-key", "c-value", true)