NET Core 2.1 + support for Service Fabric commandline parameters (#209)

* netcore 2.1

* SimpleCommandLineParserTests

* tests

* SimpleCommandLineParserTests

* test report

* AspNetCoreSelfHost

* Fixed Resharper warnings

* tests

* .

* ResponseWithProxyTests

ResponseWithProxyTests

* postmanecho
This commit is contained in:
Stef Heyenrath
2018-10-10 09:49:32 +02:00
committed by GitHub
parent 04bcca6e14
commit 83457c1601
147 changed files with 3676 additions and 3330 deletions

View File

@@ -103,18 +103,18 @@ namespace WireMock.Owin
#endif
.Build();
return Task.Run(() =>
{
StartServers();
}, _cts.Token);
return RunHost(_cts.Token);
}
private void StartServers()
private Task RunHost(CancellationToken token)
{
try
{
var appLifetime = (IApplicationLifetime)_host.Services.GetService(typeof(IApplicationLifetime));
appLifetime.ApplicationStarted.Register(() => IsStarted = true);
appLifetime.ApplicationStarted.Register(() =>
{
IsStarted = true;
});
#if NETSTANDARD1_3
_logger.Info("WireMock.Net server using netstandard1.3");
@@ -123,21 +123,23 @@ namespace WireMock.Owin
#elif NET46
_logger.Info("WireMock.Net server using .net 4.6.1 or higher");
#endif
#if NETSTANDARD1_3
_host.Run(_cts.Token);
return Task.Run(() =>
{
_host.Run(token);
});
#else
_host.RunAsync(_cts.Token).Wait();
return _host.RunAsync(token);
#endif
}
catch (Exception e)
{
_runningException = e;
_logger.Error(e.ToString());
}
finally
{
IsStarted = false;
return Task.CompletedTask;
}
}

View File

@@ -37,14 +37,12 @@ namespace WireMock.Owin
return (bestPartialMatch?.Mapping, bestPartialMatch?.MatchResult);
}
else
{
var perfectMatch = mappings
.OrderBy(m => m.Mapping.Priority)
.FirstOrDefault(m => m.MatchResult.IsPerfectMatch);
return (perfectMatch?.Mapping, perfectMatch?.MatchResult);
}
var perfectMatch = mappings
.OrderBy(m => m.Mapping.Priority)
.FirstOrDefault(m => m.MatchResult.IsPerfectMatch);
return (perfectMatch?.Mapping, perfectMatch?.MatchResult);
}
}
}

View File

@@ -50,6 +50,7 @@ namespace WireMock.Owin
Check.NotNull(options, nameof(options));
Check.NotNull(requestMapper, nameof(requestMapper));
Check.NotNull(responseMapper, nameof(responseMapper));
Check.NotNull(mappingMatcher, nameof(mappingMatcher));
_options = options;
_requestMapper = requestMapper;