diff --git a/src/WireMock.Net.Minimal/Owin/AspNetCoreSelfHost.cs b/src/WireMock.Net.Minimal/Owin/AspNetCoreSelfHost.cs
index ae5b1c6f..31aa04a6 100644
--- a/src/WireMock.Net.Minimal/Owin/AspNetCoreSelfHost.cs
+++ b/src/WireMock.Net.Minimal/Owin/AspNetCoreSelfHost.cs
@@ -11,7 +11,7 @@ using WireMock.Util;
namespace WireMock.Owin;
-internal partial class AspNetCoreSelfHost : IOwinSelfHost
+internal partial class AspNetCoreSelfHost
{
private readonly CancellationTokenSource _cts = new();
private readonly IWireMockMiddlewareOptions _wireMockMiddlewareOptions;
diff --git a/src/WireMock.Net.Minimal/Owin/IOwinSelfHost.cs b/src/WireMock.Net.Minimal/Owin/IOwinSelfHost.cs
deleted file mode 100644
index 78bfa24d..00000000
--- a/src/WireMock.Net.Minimal/Owin/IOwinSelfHost.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright © WireMock.Net
-
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using System;
-
-namespace WireMock.Owin;
-
-interface IOwinSelfHost
-{
- ///
- /// Gets a value indicating whether this server is started.
- ///
- ///
- /// true if this server is started; otherwise, false.
- ///
- bool IsStarted { get; }
-
- ///
- /// Gets the urls.
- ///
- List Urls { get; }
-
- ///
- /// Gets the ports.
- ///
- List Ports { get; }
-
- ///
- /// The exception occurred when the host is running.
- ///
- Exception? RunningException { get; }
-
- Task StartAsync();
-
- Task StopAsync();
-}
\ No newline at end of file
diff --git a/src/WireMock.Net.Minimal/Server/WireMockServer.cs b/src/WireMock.Net.Minimal/Server/WireMockServer.cs
index 045755b9..f2af7fa8 100644
--- a/src/WireMock.Net.Minimal/Server/WireMockServer.cs
+++ b/src/WireMock.Net.Minimal/Server/WireMockServer.cs
@@ -39,7 +39,7 @@ public partial class WireMockServer : IWireMockServer
private const int ServerStartDelayInMs = 100;
private readonly WireMockServerSettings _settings;
- private readonly IOwinSelfHost? _httpServer;
+ private readonly AspNetCoreSelfHost? _httpServer;
private readonly IWireMockMiddlewareOptions _options = new WireMockMiddlewareOptions();
private readonly MappingConverter _mappingConverter;
private readonly MatcherMapper _matcherMapper;
diff --git a/test/WireMock.Net.Tests/Owin/GlobalExceptionMiddlewareTests.cs b/test/WireMock.Net.Tests/Owin/GlobalExceptionMiddlewareTests.cs
index e9d28d37..76aa4c88 100644
--- a/test/WireMock.Net.Tests/Owin/GlobalExceptionMiddlewareTests.cs
+++ b/test/WireMock.Net.Tests/Owin/GlobalExceptionMiddlewareTests.cs
@@ -1,45 +1,36 @@
// Copyright © WireMock.Net
-using System.Threading.Tasks;
+using Microsoft.AspNetCore.Http;
using Moq;
using NFluent;
using WireMock.Owin;
using WireMock.Owin.Mappers;
-using Xunit;
-#if NET452
-using IContext = Microsoft.Owin.IOwinContext;
-using IResponse = Microsoft.Owin.IOwinResponse;
-#else
-using IContext = Microsoft.AspNetCore.Http.HttpContext;
-using IResponse = Microsoft.AspNetCore.Http.HttpResponse;
-#endif
-namespace WireMock.Net.Tests.Owin
+namespace WireMock.Net.Tests.Owin;
+
+public class GlobalExceptionMiddlewareTests
{
- public class GlobalExceptionMiddlewareTests
+ private readonly Mock _optionsMock;
+ private readonly Mock _responseMapperMock;
+
+ private readonly GlobalExceptionMiddleware _sut;
+
+ public GlobalExceptionMiddlewareTests()
{
- private readonly Mock _optionsMock;
- private readonly Mock _responseMapperMock;
+ _optionsMock = new Mock();
+ _optionsMock.SetupAllProperties();
- private readonly GlobalExceptionMiddleware _sut;
+ _responseMapperMock = new Mock();
+ _responseMapperMock.SetupAllProperties();
+ _responseMapperMock.Setup(m => m.MapAsync(It.IsAny(), It.IsAny())).Returns(Task.FromResult(true));
- public GlobalExceptionMiddlewareTests()
- {
- _optionsMock = new Mock();
- _optionsMock.SetupAllProperties();
+ _sut = new GlobalExceptionMiddleware(null, _optionsMock.Object, _responseMapperMock.Object);
+ }
- _responseMapperMock = new Mock();
- _responseMapperMock.SetupAllProperties();
- _responseMapperMock.Setup(m => m.MapAsync(It.IsAny(), It.IsAny())).Returns(Task.FromResult(true));
-
- _sut = new GlobalExceptionMiddleware(null, _optionsMock.Object, _responseMapperMock.Object);
- }
-
- [Fact]
- public void GlobalExceptionMiddleware_Invoke_NullAsNext_DoesNotInvokeNextAndDoesNotThrow()
- {
- // Act
- Check.ThatCode(() => _sut.Invoke(null)).DoesNotThrow();
- }
+ [Fact]
+ public void GlobalExceptionMiddleware_Invoke_NullAsNext_DoesNotInvokeNextAndDoesNotThrow()
+ {
+ // Act
+ Check.ThatCode(() => _sut.Invoke(null)).DoesNotThrow();
}
}
\ No newline at end of file
diff --git a/test/WireMock.Net.Tests/Owin/WireMockMiddlewareTests.cs b/test/WireMock.Net.Tests/Owin/WireMockMiddlewareTests.cs
index f3aeafd5..0f459b42 100644
--- a/test/WireMock.Net.Tests/Owin/WireMockMiddlewareTests.cs
+++ b/test/WireMock.Net.Tests/Owin/WireMockMiddlewareTests.cs
@@ -1,18 +1,14 @@
// Copyright © WireMock.Net
-using System;
using System.Collections.Concurrent;
using System.Linq.Expressions;
-using System.Threading.Tasks;
using Moq;
-using Xunit;
using WireMock.Models;
using WireMock.Owin;
using WireMock.Owin.Mappers;
using WireMock.Util;
using WireMock.Logging;
using WireMock.Matchers;
-using System.Collections.Generic;
using WireMock.Admin.Mappings;
using WireMock.Admin.Requests;
using WireMock.Settings;
@@ -21,21 +17,12 @@ using WireMock.Handlers;
using WireMock.Matchers.Request;
using WireMock.ResponseBuilders;
using WireMock.RequestBuilders;
+using Microsoft.AspNetCore.Http;
+
#if NET6_0_OR_GREATER
using WireMock.Owin.ActivityTracing;
using System.Diagnostics;
#endif
-#if NET452
-using Microsoft.Owin;
-using IContext = Microsoft.Owin.IOwinContext;
-using IRequest = Microsoft.Owin.IOwinRequest;
-using IResponse = Microsoft.Owin.IOwinResponse;
-#else
-using IContext = Microsoft.AspNetCore.Http.HttpContext;
-using IRequest = Microsoft.AspNetCore.Http.HttpRequest;
-using IResponse = Microsoft.AspNetCore.Http.HttpResponse;
-using Microsoft.AspNetCore.Http;
-#endif
namespace WireMock.Net.Tests.Owin;
@@ -51,7 +38,7 @@ public class WireMockMiddlewareTests
private readonly Mock _matcherMock;
private readonly Mock _mappingMock;
private readonly Mock _requestMatchResultMock;
- private readonly Mock _contextMock;
+ private readonly Mock _contextMock;
private readonly WireMockMiddleware _sut;
@@ -76,13 +63,13 @@ public class WireMockMiddlewareTests
_responseMapperMock = new Mock();
_responseMapperMock.SetupAllProperties();
- _responseMapperMock.Setup(m => m.MapAsync(It.IsAny(), It.IsAny())).Returns(Task.FromResult(true));
+ _responseMapperMock.Setup(m => m.MapAsync(It.IsAny(), It.IsAny())).Returns(Task.FromResult(true));
_matcherMock = new Mock();
_matcherMock.SetupAllProperties();
// _matcherMock.Setup(m => m.FindBestMatch(It.IsAny())).Returns((new MappingMatcherResult(), new MappingMatcherResult()));
- _contextMock = new Mock();
+ _contextMock = new Mock();
_contextMock.SetupGet(c => c.Items).Returns(new Dictionary