Updated WireMock as a standalone process (markdown)

Stef Heyenrath
2019-03-26 12:51:07 +01:00
parent 6d6f2a6f00
commit f72e23c057
+8 -7
@@ -52,17 +52,18 @@ static void Main(string[] args)
port = 8080;
var server = FluentMockServer.Start(port);
Console.WriteLine("FluentMockServer running at {0}", server.Port);
Console.WriteLine("FluentMockServer running at {0}", string.Join(",", server.Ports));
// Order of rules matters. First matching is taken.
server
.Given(Request.Create().WithUrl(u => u.Contains("x")).UsingGet())
.Given(Request.Create().WithPath(u => u.Contains("x")).UsingGet())
.RespondWith(Response.Create()
.WithStatusCode(200)
.WithHeader("Content-Type", "application/json")
.WithBody(@"{ ""result"": ""/x with FUNC 200""}"));
server
.Given(Request.Create().WithUrl("/*").UsingGet())
.Given(Request.Create().WithPath("/*").UsingGet())
.RespondWith(Response.Create()
.WithStatusCode(200)
.WithHeader("Content-Type", "application/json")
@@ -70,21 +71,21 @@ static void Main(string[] args)
);
server
.Given(Request.Create().WithUrl("/data").UsingPost().WithBody(b => b.Contains("e")))
.Given(Request.Create().WithPath("/data").UsingPost().WithBody(b => b.Contains("e")))
.RespondWith(Response.Create()
.WithStatusCode(201)
.WithHeader("Content-Type", "application/json")
.WithBody(@"{ ""result"": ""data posted with FUNC 201""}"));
server
.Given(Request.Create().WithUrl("/data").UsingPost())
.Given(Request.Create().WithPath("/data").UsingPost())
.RespondWith(Response.Create()
.WithStatusCode(201)
.WithHeader("Content-Type", "application/json")
.WithBody(@"{ ""result"": ""data posted with 201""}"));
server
.Given(Request.Create().WithUrl("/data").UsingDelete())
.Given(Request.Create().WithPath("/data").UsingDelete())
.RespondWith(Response.Create()
.WithStatusCode(200)
.WithHeader("Content-Type", "application/json")
@@ -94,7 +95,7 @@ static void Main(string[] args)
Console.ReadKey();
Console.WriteLine("Displaying all requests");
var allRequests = server.RequestLogs;
var allRequests = server.LogEntries;
Console.WriteLine(JsonConvert.SerializeObject(allRequests, Formatting.Indented));
Console.WriteLine("Press any key to quit");