mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-05-30 11:40:47 +02:00
StandAloneApp: FluentMockServerSettings
This commit is contained in:
@@ -5,6 +5,8 @@ using CommandLineParser.Arguments;
|
|||||||
using CommandLineParser.Exceptions;
|
using CommandLineParser.Exceptions;
|
||||||
using WireMock.Server;
|
using WireMock.Server;
|
||||||
using WireMock.Settings;
|
using WireMock.Settings;
|
||||||
|
using WireMock.Validation;
|
||||||
|
using JetBrains.Annotations;
|
||||||
|
|
||||||
namespace WireMock.Net.StandAlone
|
namespace WireMock.Net.StandAlone
|
||||||
{
|
{
|
||||||
@@ -37,12 +39,32 @@ namespace WireMock.Net.StandAlone
|
|||||||
public string X509Certificate2Filename { get; set; }
|
public string X509Certificate2Filename { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Start WireMock.Net standalone bases on the FluentMockServerSettings.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="settings">The FluentMockServerSettings</param>
|
||||||
|
/// <param name="allowPartialMapping">Allow Partial Mapping (default set to false).</param>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Start WireMock.Net standalone bases on the commandline arguments.
|
/// Start WireMock.Net standalone bases on the commandline arguments.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="args">The commandline arguments</param>
|
/// <param name="args">The commandline arguments</param>
|
||||||
public static FluentMockServer Start(string[] args)
|
public static FluentMockServer Start([NotNull] string[] args)
|
||||||
{
|
{
|
||||||
|
Check.NotNull(args, nameof(args));
|
||||||
|
|
||||||
var options = new Options();
|
var options = new Options();
|
||||||
var parser = new CommandLineParser.CommandLineParser();
|
var parser = new CommandLineParser.CommandLineParser();
|
||||||
parser.ExtractArgumentAttributes(options);
|
parser.ExtractArgumentAttributes(options);
|
||||||
@@ -73,11 +95,7 @@ namespace WireMock.Net.StandAlone
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
var server = FluentMockServer.Start(settings);
|
FluentMockServer server = Start(settings, options.AllowPartialMapping);
|
||||||
if (options.AllowPartialMapping)
|
|
||||||
{
|
|
||||||
server.AllowPartialMapping();
|
|
||||||
}
|
|
||||||
|
|
||||||
Console.WriteLine("WireMock.Net server listening at {0}", string.Join(" and ", server.Urls));
|
Console.WriteLine("WireMock.Net server listening at {0}", string.Join(" and ", server.Urls));
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Description>Lightweight StandAlone Http Mocking Server for .Net.</Description>
|
<Description>Lightweight StandAlone Http Mocking Server for .Net.</Description>
|
||||||
<AssemblyTitle>WireMock.Net.StandAlone</AssemblyTitle>
|
<AssemblyTitle>WireMock.Net.StandAlone</AssemblyTitle>
|
||||||
<Version>1.0.1.0</Version>
|
<Version>1.0.2.0</Version>
|
||||||
<Authors>Stef Heyenrath</Authors>
|
<Authors>Stef Heyenrath</Authors>
|
||||||
<TargetFrameworks>net45;net452;net46;netstandard1.3</TargetFrameworks>
|
<TargetFrameworks>net45;net452;net46;netstandard1.3</TargetFrameworks>
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
@@ -27,6 +27,9 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="JetBrains.Annotations" Version="10.4.0">
|
||||||
|
<PrivateAssets>All</PrivateAssets>
|
||||||
|
</PackageReference>
|
||||||
<PackageReference Include="CommandLineArgumentsParser" Version="3.0.11" />
|
<PackageReference Include="CommandLineArgumentsParser" Version="3.0.11" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
|
[assembly: InternalsVisibleTo("WireMock.Net.StandAlone")]
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Description>Lightweight Http Mocking Server for .Net, inspired by WireMock from the Java landscape.</Description>
|
<Description>Lightweight Http Mocking Server for .Net, inspired by WireMock from the Java landscape.</Description>
|
||||||
<AssemblyTitle>WireMock.Net</AssemblyTitle>
|
<AssemblyTitle>WireMock.Net</AssemblyTitle>
|
||||||
<Version>1.0.2.1</Version>
|
<Version>1.0.2.2</Version>
|
||||||
<Authors>Alexandre Victoor;Stef Heyenrath</Authors>
|
<Authors>Alexandre Victoor;Stef Heyenrath</Authors>
|
||||||
<TargetFrameworks>net45;net452;net46;netstandard1.3</TargetFrameworks>
|
<TargetFrameworks>net45;net452;net46;netstandard1.3</TargetFrameworks>
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
|
|||||||
Reference in New Issue
Block a user