mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-19 08:37:23 +01:00
Small code refactor (#117)
This commit is contained in:
@@ -108,13 +108,12 @@ namespace WireMock.Owin
|
||||
{
|
||||
IsStarted = true;
|
||||
#if NETSTANDARD1_3
|
||||
_logger.Info("WireMock.Net server using netstandard1.3");
|
||||
_logger.Info("WireMock.Net server using netstandard1.3");
|
||||
_host.Run(_cts.Token);
|
||||
#else
|
||||
_logger.Info("WireMock.Net server using netstandard2.0");
|
||||
_host.Run();
|
||||
#endif
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
@@ -17,17 +17,11 @@ namespace WireMock.Owin
|
||||
/// <summary>
|
||||
/// Gets the urls.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The urls.
|
||||
/// </value>
|
||||
List<string> Urls { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the ports.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The ports.
|
||||
/// </value>
|
||||
List<int> Ports { get; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
// using System.IO;
|
||||
using System.Linq;
|
||||
// using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WireMock.Util;
|
||||
#if !NETSTANDARD
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace WireMock.Owin
|
||||
app.Use<WireMockMiddleware>(_options);
|
||||
_options.PostWireMockMiddlewareInit?.Invoke(app);
|
||||
};
|
||||
|
||||
|
||||
foreach (var url in Urls)
|
||||
{
|
||||
servers.Add(WebApp.Start(url, startup));
|
||||
@@ -104,7 +104,7 @@ namespace WireMock.Owin
|
||||
{
|
||||
IsStarted = false;
|
||||
// Dispose all servers in finally block to make sure clean up allocated resource on error happening
|
||||
servers.ForEach((s) => s.Dispose());
|
||||
servers.ForEach(s => s.Dispose());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace WireMock.Server
|
||||
/// Gets a value indicating whether this server is started.
|
||||
/// </summary>
|
||||
[PublicAPI]
|
||||
public bool IsStarted { get => _httpServer == null ? false : _httpServer.IsStarted; }
|
||||
public bool IsStarted => _httpServer != null && _httpServer.IsStarted;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the ports.
|
||||
@@ -200,7 +200,7 @@ namespace WireMock.Server
|
||||
{
|
||||
throw new TimeoutException($"Service start timed out after {TimeSpan.FromMilliseconds(settings.StartTimeout)}");
|
||||
}
|
||||
ctsStartTimeout.Token.WaitHandle.WaitOne(100);
|
||||
ctsStartTimeout.Token.WaitHandle.WaitOne(ServerStartDelay);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user