mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-23 00:38:28 +02:00
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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user