This commit is contained in:
Stef Heyenrath
2023-05-13 09:34:57 +02:00
parent 6ef116a295
commit 9f1a15a917
5 changed files with 133 additions and 49 deletions

View File

@@ -709,6 +709,25 @@ namespace WireMock.Net.ConsoleApplication
.WithWebhookFireAndForget(true)
.RespondWith(Response.Create().WithBody("a-response"));
server
.Given(Request.Create().WithPath("/todo/items").UsingGet())
.InScenario("To do list")
.WillSetStateTo("TodoList State Started")
.RespondWith(Response.Create().WithBody("Buy milk"));
server
.Given(Request.Create().WithPath("/todo/items").UsingPost())
.InScenario("To do list")
.WhenStateIs("TodoList State Started")
.WillSetStateTo("Cancel newspaper item added")
.RespondWith(Response.Create().WithStatusCode(201));
server
.Given(Request.Create().WithPath("/todo/items").UsingGet())
.InScenario("To do list")
.WhenStateIs("Cancel newspaper item added")
.RespondWith(Response.Create().WithBody("Buy milk;Cancel newspaper subscription"));
System.Console.WriteLine(JsonConvert.SerializeObject(server.MappingModels, Formatting.Indented));
System.Console.WriteLine("Press any key to stop the server");

View File

@@ -1,5 +1,9 @@
using System.IO;
using log4net.Config;
using WireMock.FluentAssertions;
using WireMock.RequestBuilders;
using WireMock.ResponseBuilders;
using WireMock.Server;
namespace WireMock.Net.ConsoleApplication;
@@ -9,6 +13,25 @@ static class Program
{
XmlConfigurator.Configure(new FileInfo("log4net.config"));
MainApp.Run();
var server = WireMockServer.Start();
server
.Given(Request.Create()
.WithPath("todos")
.UsingGet()
)
.RespondWith(Response.Create()
.WithBody("test")
);
server
.Should()
.HaveReceivedACall()
.AtAbsoluteUrl("some-url").And
.WithHeader("header-name", "header-value");
server.Stop();
// MainApp.Run();
}
}