diff --git a/src/WireMock.Net.StandAlone/StandAloneApp.cs b/src/WireMock.Net.StandAlone/StandAloneApp.cs index 1100dc9a..2d75efa3 100644 --- a/src/WireMock.Net.StandAlone/StandAloneApp.cs +++ b/src/WireMock.Net.StandAlone/StandAloneApp.cs @@ -5,6 +5,8 @@ using CommandLineParser.Arguments; using CommandLineParser.Exceptions; using WireMock.Server; using WireMock.Settings; +using WireMock.Validation; +using JetBrains.Annotations; namespace WireMock.Net.StandAlone { @@ -37,12 +39,32 @@ namespace WireMock.Net.StandAlone public string X509Certificate2Filename { get; set; } } + /// + /// Start WireMock.Net standalone bases on the FluentMockServerSettings. + /// + /// The FluentMockServerSettings + /// Allow Partial Mapping (default set to false). + public static FluentMockServer Start([NotNull] FluentMockServerSettings settings, bool allowPartialMapping = false) + { + Check.NotNull(settings, nameof(settings)); + + var server = FluentMockServer.Start(settings); + if (allowPartialMapping) + { + server.AllowPartialMapping(); + } + + return server; + } + /// /// Start WireMock.Net standalone bases on the commandline arguments. /// /// The commandline arguments - public static FluentMockServer Start(string[] args) + public static FluentMockServer Start([NotNull] string[] args) { + Check.NotNull(args, nameof(args)); + var options = new Options(); var parser = new CommandLineParser.CommandLineParser(); parser.ExtractArgumentAttributes(options); @@ -73,11 +95,7 @@ namespace WireMock.Net.StandAlone }; } - var server = FluentMockServer.Start(settings); - if (options.AllowPartialMapping) - { - server.AllowPartialMapping(); - } + FluentMockServer server = Start(settings, options.AllowPartialMapping); Console.WriteLine("WireMock.Net server listening at {0}", string.Join(" and ", server.Urls)); diff --git a/src/WireMock.Net.StandAlone/WireMock.Net.StandAlone.csproj b/src/WireMock.Net.StandAlone/WireMock.Net.StandAlone.csproj index c7bee9ff..a89d80c7 100644 --- a/src/WireMock.Net.StandAlone/WireMock.Net.StandAlone.csproj +++ b/src/WireMock.Net.StandAlone/WireMock.Net.StandAlone.csproj @@ -3,7 +3,7 @@ Lightweight StandAlone Http Mocking Server for .Net. WireMock.Net.StandAlone - 1.0.1.0 + 1.0.2.0 Stef Heyenrath net45;net452;net46;netstandard1.3 true @@ -27,6 +27,9 @@ + + All + diff --git a/src/WireMock.Net/Properties/AssemblyInfo.cs b/src/WireMock.Net/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..60a444e7 --- /dev/null +++ b/src/WireMock.Net/Properties/AssemblyInfo.cs @@ -0,0 +1,3 @@ +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("WireMock.Net.StandAlone")] \ No newline at end of file diff --git a/src/WireMock.Net/WireMock.Net.csproj b/src/WireMock.Net/WireMock.Net.csproj index b764c0af..79fe19b1 100644 --- a/src/WireMock.Net/WireMock.Net.csproj +++ b/src/WireMock.Net/WireMock.Net.csproj @@ -3,7 +3,7 @@ Lightweight Http Mocking Server for .Net, inspired by WireMock from the Java landscape. WireMock.Net - 1.0.2.1 + 1.0.2.2 Alexandre Victoor;Stef Heyenrath net45;net452;net46;netstandard1.3 true