From e32a23afc0ec8f1df772d6a6c29ce18f3ccb0e95 Mon Sep 17 00:00:00 2001 From: Stef Heyenrath Date: Mon, 19 Jun 2017 08:49:02 +0200 Subject: [PATCH] Updated WireMock as a standalone process (markdown) --- WireMock-as-a-standalone-process.md | 33 ++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/WireMock-as-a-standalone-process.md b/WireMock-as-a-standalone-process.md index d6abe45..0788203 100644 --- a/WireMock-as-a-standalone-process.md +++ b/WireMock-as-a-standalone-process.md @@ -1,6 +1,37 @@ -##WireMock as a standalone process +## WireMock as a standalone process This is quite straight forward to launch a mock server within a console application. +### Option 1 : using the WireMock.Net.StandAlone library (https://www.nuget.org/packages/WireMock.Net.StandAlone/) +```c# +class Program +{ + static void Main(string[] args) + { + StandAloneApp.Start(args); + + Console.WriteLine("Press any key to stop the server"); + Console.ReadKey(); + } +} +``` + +### Option 2 : using the WireMock.Net.StandAlone library using the settings object +```c# +class Program +{ + static void Main(string[] args) + { + var settings = new FluentMockServerSettings { }; // see source code for all the possible properties + bool allowPartialMapping = true; + StandAloneApp.Start(settings, allowPartialMapping); + + Console.WriteLine("Press any key to stop the server"); + Console.ReadKey(); + } +} +``` + +### Option 3 : coding yourself ```c# static void Main(string[] args) {