Add Func<> matchhing. Solves issue #2

This commit is contained in:
Stef Heyenrath
2017-01-18 20:45:38 +01:00
parent 9d1fd8fd51
commit 65c17ff519
16 changed files with 321 additions and 118 deletions

View File

@@ -18,17 +18,26 @@ namespace WireMock.Net.ConsoleApplication
Console.WriteLine("FluentMockServer running at {0}", server.Port);
server
.Given(
Request
.WithUrl("/*")
.UsingGet()
)
.RespondWith(
Response
.WithStatusCode(200)
.WithHeader("Content-Type", "application/json")
.WithBody(@"{ ""msg"": ""Hello world!""}")
);
.Given(Request.WithUrl(u => u.Contains("x")).UsingGet())
.RespondWith(Response
.WithStatusCode(200)
.WithHeader("Content-Type", "application/json")
.WithBody(@"{ ""result"": ""/x with FUNC 200""}"));
server
.Given(Request.WithUrl("/*").UsingGet())
.RespondWith(Response
.WithStatusCode(200)
.WithHeader("Content-Type", "application/json")
.WithBody(@"{ ""msg"": ""Hello world!""}")
);
server
.Given(Request.WithUrl("/data").UsingPost().WithBody(b => b.Contains("e")))
.RespondWith(Response
.WithStatusCode(201)
.WithHeader("Content-Type", "application/json")
.WithBody(@"{ ""result"": ""data posted with FUNC 201""}"));
server
.Given(Request.WithUrl("/data").UsingPost())
@@ -42,12 +51,11 @@ namespace WireMock.Net.ConsoleApplication
.RespondWith(Response
.WithStatusCode(200)
.WithHeader("Content-Type", "application/json")
.WithBody(@"{ ""result"": ""data deleted with 201""}"));
.WithBody(@"{ ""result"": ""data deleted with 200""}"));
Console.WriteLine("Press any key to stop the server");
Console.ReadKey();
Console.WriteLine("Displaying all requests");
var allRequests = server.RequestLogs;
Console.WriteLine(JsonConvert.SerializeObject(allRequests, Formatting.Indented));