From f72e23c057fb7596fb16b9be933369f413fe7e17 Mon Sep 17 00:00:00 2001 From: Stef Heyenrath Date: Tue, 26 Mar 2019 12:51:07 +0100 Subject: [PATCH] Updated WireMock as a standalone process (markdown) --- WireMock-as-a-standalone-process.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/WireMock-as-a-standalone-process.md b/WireMock-as-a-standalone-process.md index c0f6547..506c819 100644 --- a/WireMock-as-a-standalone-process.md +++ b/WireMock-as-a-standalone-process.md @@ -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");