mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-21 00:28:59 +01:00
* refactor * rename api * -preview-01 * logger * move * RandomDataGenerator.Net * . * ISettings * renames... * refactor CommandlineParser logic * remove standalone * Remove Interfaces * Update tests * WireMock.Net.StandAlone * . * fix * . * _settings * Admin * WireMock.Net.Abstractions * fix build * rename WireMockServer * fix compile errors
48 lines
1.6 KiB
C#
48 lines
1.6 KiB
C#
using JetBrains.Annotations;
|
|
using System.Linq;
|
|
using WireMock.Logging;
|
|
using WireMock.Server;
|
|
using WireMock.Settings;
|
|
using WireMock.Validation;
|
|
|
|
namespace WireMock.Net.StandAlone
|
|
{
|
|
/// <summary>
|
|
/// The StandAloneApp
|
|
/// </summary>
|
|
public static class StandAloneApp
|
|
{
|
|
/// <summary>
|
|
/// Start WireMock.Net standalone Server based on the FluentMockServerSettings.
|
|
/// </summary>
|
|
/// <param name="settings">The FluentMockServerSettings</param>
|
|
[PublicAPI]
|
|
public static WireMockServer Start([NotNull] FluentMockServerSettings settings)
|
|
{
|
|
Check.NotNull(settings, nameof(settings));
|
|
|
|
var server = WireMockServer.Start(settings);
|
|
|
|
settings.Logger.Info("WireMock.Net server listening at {0}", string.Join(",", server.Urls));
|
|
|
|
return server;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Start WireMock.Net standalone Server based on the commandline arguments.
|
|
/// </summary>
|
|
/// <param name="args">The commandline arguments</param>
|
|
/// <param name="logger">The logger</param>
|
|
[PublicAPI]
|
|
public static WireMockServer Start([NotNull] string[] args, [CanBeNull] IWireMockLogger logger = null)
|
|
{
|
|
Check.NotNull(args, nameof(args));
|
|
|
|
var settings = (FluentMockServerSettings) WireMockServerSettingsParser.ParseArguments(args);
|
|
|
|
settings.Logger.Debug("WireMock.Net server arguments [{0}]", string.Join(", ", args.Select(a => $"'{a}'")));
|
|
|
|
return Start(settings);
|
|
}
|
|
}
|
|
} |