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;

View File

@@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Newtonsoft.Json;
using WireMock.Handlers;
using WireMock.Logging;
@@ -24,10 +25,10 @@ namespace WireMock.Server
/// </summary>
public partial class FluentMockServer : IDisposable
{
private const int ServerStartDelayInMs = 100;
private readonly IWireMockLogger _logger;
private readonly IFileSystemHandler _fileSystemHandler;
private const int ServerStartDelay = 100;
private readonly IOwinSelfHost _httpServer;
private readonly IWireMockMiddlewareOptions _options = new WireMockMiddlewareOptions();
@@ -231,7 +232,7 @@ namespace WireMock.Server
throw new TimeoutException($"Service start timed out after {TimeSpan.FromMilliseconds(settings.StartTimeout)}");
}
ctsStartTimeout.Token.WaitHandle.WaitOne(ServerStartDelay);
ctsStartTimeout.Token.WaitHandle.WaitOne(ServerStartDelayInMs);
}
}

View File

@@ -2,7 +2,7 @@
<PropertyGroup>
<Description>Lightweight Http Mocking Server for .Net, inspired by WireMock from the Java landscape.</Description>
<AssemblyTitle>WireMock.Net</AssemblyTitle>
<Version>1.0.4.17</Version>
<Version>1.0.4.18</Version>
<Authors>Stef Heyenrath</Authors>
<TargetFrameworks>net451;net452;net46;net461;netstandard1.3;netstandard2.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>