mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-10 19:27:09 +02:00
Update WireMock.Net.StandAlone
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using CommandLineParser.Arguments;
|
using CommandLineParser.Arguments;
|
||||||
using CommandLineParser.Exceptions;
|
using CommandLineParser.Exceptions;
|
||||||
using WireMock.Server;
|
using WireMock.Server;
|
||||||
@@ -9,11 +11,11 @@ namespace WireMock.Net.StandAlone
|
|||||||
{
|
{
|
||||||
private class Options
|
private class Options
|
||||||
{
|
{
|
||||||
[ValueArgument(typeof(string), 'u', "Urls", Description = "URL(s) to listen on", Optional = false, AllowMultiple = true)]
|
[ValueArgument(typeof(string), 'u', "Urls", Description = "URL(s) to listen on.", Optional = true, AllowMultiple = true)]
|
||||||
public string[] Urls;
|
public List<string> Urls { get; set; }
|
||||||
|
|
||||||
[SwitchArgument('p', "AllowPartialMapping", true, Description = "Allow Partial Mapping (default set to true)", Optional = true)]
|
[SwitchArgument('p', "AllowPartialMapping", true, Description = "Allow Partial Mapping (default set to true).", Optional = true)]
|
||||||
public bool AllowPartialMapping;
|
public bool AllowPartialMapping { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Main(params string[] args)
|
static void Main(params string[] args)
|
||||||
@@ -21,13 +23,15 @@ namespace WireMock.Net.StandAlone
|
|||||||
var options = new Options();
|
var options = new Options();
|
||||||
var parser = new CommandLineParser.CommandLineParser();
|
var parser = new CommandLineParser.CommandLineParser();
|
||||||
parser.ExtractArgumentAttributes(options);
|
parser.ExtractArgumentAttributes(options);
|
||||||
parser.ParseCommandLine(args);
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
parser.ParseCommandLine(args);
|
parser.ParseCommandLine(args);
|
||||||
|
|
||||||
var server = FluentMockServer.StartWithAdminInterface(options.Urls);
|
if (!options.Urls.Any())
|
||||||
|
options.Urls.Add("http://localhost:9090/");
|
||||||
|
|
||||||
|
var server = FluentMockServer.StartWithAdminInterface(options.Urls.ToArray());
|
||||||
|
|
||||||
if (options.AllowPartialMapping)
|
if (options.AllowPartialMapping)
|
||||||
server.AllowPartialMapping();
|
server.AllowPartialMapping();
|
||||||
|
|||||||
Reference in New Issue
Block a user