mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-01 07:03:29 +02:00
...
This commit is contained in:
@@ -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");
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user