mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-23 09:30:59 +01:00
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:
@@ -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('#');
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user