Add MappingBuilder to build mappings in code and export to Models or JSON (#869)

* MappingBuilder

* .

* ...

* sc

* t

* .
This commit is contained in:
Stef Heyenrath
2023-01-06 19:11:56 +01:00
committed by GitHub
parent 742f1d1f0a
commit 20eb37b0c8
10 changed files with 465 additions and 142 deletions

View File

@@ -37,6 +37,20 @@ namespace WireMock.Net.ConsoleApplication
{
public static void Run()
{
var mappingBuilder = new MappingBuilder();
mappingBuilder
.Given(Request
.Create()
.WithPath(new WildcardMatcher("/param2", true))
.WithParam("key", "test")
.UsingGet())
.RespondWith(Response.Create()
.WithHeader("Content-Type", "application/json")
.WithBodyAsJson(new { result = "param2" }));
var json = mappingBuilder.ToJson();
System.Console.WriteLine("mappingBuilder : Json = {0}", json);
var s = WireMockServer.Start();
s.Stop();