diff --git a/src/WireMock.Net.Abstractions/Admin/Settings/SettingsModel.cs b/src/WireMock.Net.Abstractions/Admin/Settings/SettingsModel.cs index 0683090a..976dfcd9 100644 --- a/src/WireMock.Net.Abstractions/Admin/Settings/SettingsModel.cs +++ b/src/WireMock.Net.Abstractions/Admin/Settings/SettingsModel.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Text.RegularExpressions; -using JetBrains.Annotations; using WireMock.Handlers; using WireMock.Types; @@ -123,7 +122,6 @@ public class SettingsModel /// public Dictionary? ProtoDefinitions { get; set; } -//#if NETSTANDARD1_3_OR_GREATER || NET461 /// /// Server client certificate mode /// @@ -133,5 +131,4 @@ public class SettingsModel /// Whether to accept any client certificate /// public bool AcceptAnyClientCertificate { get; set; } -//#endif } \ No newline at end of file diff --git a/src/WireMock.Net.Abstractions/IRequestMessage.cs b/src/WireMock.Net.Abstractions/IRequestMessage.cs index f688f610..7b42291f 100644 --- a/src/WireMock.Net.Abstractions/IRequestMessage.cs +++ b/src/WireMock.Net.Abstractions/IRequestMessage.cs @@ -3,9 +3,6 @@ using System; using System.Collections.Generic; using System.Security.Cryptography.X509Certificates; -//#if NETSTANDARD1_3_OR_GREATER || NET461 -//using System.Security.Cryptography.X509Certificates; -//#endif using WireMock.Types; using WireMock.Util; @@ -119,13 +116,11 @@ public interface IRequestMessage /// byte[]? BodyAsBytes { get; } -//#if MIMEKIT /// /// The original body as MimeMessage. /// Convenience getter for Handlebars and WireMockAssertions. /// Models.Mime.IMimeMessageData? BodyAsMimeMessage { get; } -//#endif /// /// The detected body type. Convenience getter for Handlebars. @@ -170,10 +165,8 @@ public interface IRequestMessage /// The query parameter value as WireMockList or null when not found. WireMockList? GetParameter(string key, bool ignoreCase = false); -//#if NETSTANDARD1_3_OR_GREATER || NET461 /// /// Gets the connection's client certificate /// X509Certificate2? ClientCertificate { get; } -//#endif } \ No newline at end of file diff --git a/src/WireMock.Net.Abstractions/Types/ClientCertificateMode.cs b/src/WireMock.Net.Abstractions/Types/ClientCertificateMode.cs index 4fd96695..8dc9fea2 100644 --- a/src/WireMock.Net.Abstractions/Types/ClientCertificateMode.cs +++ b/src/WireMock.Net.Abstractions/Types/ClientCertificateMode.cs @@ -2,7 +2,6 @@ namespace WireMock.Types; -//#if NETSTANDARD1_3_OR_GREATER || NET461 /// /// Describes the client certificate requirements for a HTTPS connection. /// This enum is the same as https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.server.kestrel.https.clientcertificatemode @@ -29,5 +28,4 @@ public enum ClientCertificateMode /// It may be requested by the application later. /// DelayCertificate, -} -//#endif \ No newline at end of file +} \ No newline at end of file diff --git a/src/WireMock.Net.Minimal/Authentication/AzureADAuthenticationMatcher.cs b/src/WireMock.Net.Minimal/Authentication/AzureADAuthenticationMatcher.cs index ac036fec..dc23a5c4 100644 --- a/src/WireMock.Net.Minimal/Authentication/AzureADAuthenticationMatcher.cs +++ b/src/WireMock.Net.Minimal/Authentication/AzureADAuthenticationMatcher.cs @@ -1,6 +1,5 @@ // Copyright © WireMock.Net -//#if !NETSTANDARD1_3 using System; using System.Diagnostics.CodeAnalysis; using System.IdentityModel.Tokens.Jwt; @@ -111,5 +110,4 @@ internal class AzureADAuthenticationMatcher : IStringMatcher tenant = null; return false; } -} -//#endif \ No newline at end of file +} \ No newline at end of file diff --git a/src/WireMock.Net.Minimal/Http/HttpClientBuilder.cs b/src/WireMock.Net.Minimal/Http/HttpClientBuilder.cs index ee64b886..446130a5 100644 --- a/src/WireMock.Net.Minimal/Http/HttpClientBuilder.cs +++ b/src/WireMock.Net.Minimal/Http/HttpClientBuilder.cs @@ -56,10 +56,8 @@ internal static class HttpClientBuilder } } -//#if !NETSTANDARD1_3 ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls; ServicePointManager.ServerCertificateValidationCallback = (message, cert, chain, errors) => true; -//#endif return HttpClientFactory2.Create(handler); } diff --git a/src/WireMock.Net.Minimal/HttpsCertificate/CertificateLoader.cs b/src/WireMock.Net.Minimal/HttpsCertificate/CertificateLoader.cs index 8372f9fa..1dfcb889 100644 --- a/src/WireMock.Net.Minimal/HttpsCertificate/CertificateLoader.cs +++ b/src/WireMock.Net.Minimal/HttpsCertificate/CertificateLoader.cs @@ -43,11 +43,8 @@ internal static class CertificateLoader } finally { -//#if NETSTANDARD || NET48 certStore.Dispose(); -//#else certStore.Close(); -//#endif } } @@ -113,11 +110,8 @@ internal static class CertificateLoader } finally { -//#if NETSTANDARD || NET46 certStore.Dispose(); -//#else certStore.Close(); -//#endif } } } \ No newline at end of file diff --git a/src/WireMock.Net.Minimal/Matchers/XPathMatcher.cs b/src/WireMock.Net.Minimal/Matchers/XPathMatcher.cs index d614a114..581ce144 100644 --- a/src/WireMock.Net.Minimal/Matchers/XPathMatcher.cs +++ b/src/WireMock.Net.Minimal/Matchers/XPathMatcher.cs @@ -11,9 +11,7 @@ using WireMock.Models; using Stef.Validation; using WireMock.Admin.Mappings; using WireMock.Util; -//#if !NETSTANDARD1_3 using Wmhelp.XPath2; -//#endif namespace WireMock.Matchers; @@ -135,7 +133,7 @@ public class XPathMatcher : IStringMatcher } catch { - _xmlDocument = default; + _xmlDocument = null; } } @@ -151,25 +149,17 @@ public class XPathMatcher : IStringMatcher var xmlNamespaceManager = GetXmlNamespaceManager(xmlNamespaceMap); if (xmlNamespaceManager == null) { -//#if NETSTANDARD1_3 - //return navigator.Evaluate(xpath); -//#else return navigator.XPath2Evaluate(xpath); -//#endif } -//#if NETSTANDARD1_3 - //return navigator.Evaluate(xpath, xmlNamespaceManager); -//#else return navigator.XPath2Evaluate(xpath, xmlNamespaceManager); -//#endif } private XmlNamespaceManager? GetXmlNamespaceManager(IEnumerable? xmlNamespaceMap) { if (_xpathNavigator == null || xmlNamespaceMap == null) { - return default; + return null; } var nsManager = new XmlNamespaceManager(_xpathNavigator.NameTable); diff --git a/src/WireMock.Net.Minimal/Owin/AspNetCoreSelfHost.NETStandard.cs b/src/WireMock.Net.Minimal/Owin/AspNetCoreSelfHost.NETStandard.cs index 68539fb8..b0a6e2f2 100644 --- a/src/WireMock.Net.Minimal/Owin/AspNetCoreSelfHost.NETStandard.cs +++ b/src/WireMock.Net.Minimal/Owin/AspNetCoreSelfHost.NETStandard.cs @@ -1,6 +1,5 @@ // Copyright © WireMock.Net -//#if USE_ASPNETCORE && !NETSTANDARD1_3 using System; using System.Collections.Generic; using System.Net; @@ -116,5 +115,4 @@ internal static class IWebHostBuilderExtensions services.Configure(context.Configuration.GetSection("Kestrel")); }); } -} -//#endif \ No newline at end of file +} \ No newline at end of file diff --git a/src/WireMock.Net.Minimal/Owin/AspNetCoreSelfHost.cs b/src/WireMock.Net.Minimal/Owin/AspNetCoreSelfHost.cs index cd69fcd6..a1fc47b4 100644 --- a/src/WireMock.Net.Minimal/Owin/AspNetCoreSelfHost.cs +++ b/src/WireMock.Net.Minimal/Owin/AspNetCoreSelfHost.cs @@ -1,6 +1,5 @@ // Copyright © WireMock.Net -//#if USE_ASPNETCORE using System; using System.Collections.Generic; using System.IO; @@ -96,10 +95,6 @@ internal partial class AspNetCoreSelfHost : IOwinSelfHost SetHttpsAndUrls(options, _wireMockMiddlewareOptions, _urlOptions.GetDetails()); }) .ConfigureKestrelServerOptions() - - //#if NETSTANDARD1_3 - // .UseUrls(_urlOptions.GetDetails().Select(u => u.Url).ToArray()) - //#endif .Build(); return RunHost(_cts.Token); @@ -137,14 +132,7 @@ internal partial class AspNetCoreSelfHost : IOwinSelfHost _logger.Info("Server using .NET Framework 4.8"); #endif - //#if NETSTANDARD1_3 - // return Task.Run(() => - // { - // _host.Run(token); - // }); - //#else return _host.RunAsync(token); - //#endif } catch (Exception e) { @@ -162,11 +150,6 @@ internal partial class AspNetCoreSelfHost : IOwinSelfHost _cts.Cancel(); IsStarted = false; - //#if NETSTANDARD1_3 - // return Task.CompletedTask; - //#else return _host.StopAsync(); - //#endif } -} -//#endif \ No newline at end of file +} \ No newline at end of file diff --git a/src/WireMock.Net.Minimal/Owin/GlobalExceptionMiddleware.cs b/src/WireMock.Net.Minimal/Owin/GlobalExceptionMiddleware.cs index e1b15a38..47fee895 100644 --- a/src/WireMock.Net.Minimal/Owin/GlobalExceptionMiddleware.cs +++ b/src/WireMock.Net.Minimal/Owin/GlobalExceptionMiddleware.cs @@ -6,49 +6,24 @@ using Newtonsoft.Json; using WireMock.Owin.Mappers; using Stef.Validation; using Microsoft.AspNetCore.Http; -//#if !USE_ASPNETCORE -//using Microsoft.Owin; -//using IContext = Microsoft.Owin.IOwinContext; -//using OwinMiddleware = Microsoft.Owin.OwinMiddleware; -//using Next = Microsoft.Owin.OwinMiddleware; -//#else -//using OwinMiddleware = System.Object; -//using IContext = Microsoft.AspNetCore.Http.HttpContext; -//using Next = Microsoft.AspNetCore.Http.RequestDelegate; -//#endif - namespace WireMock.Owin; -internal class GlobalExceptionMiddleware //: OwinMiddleware +internal class GlobalExceptionMiddleware { private readonly IWireMockMiddlewareOptions _options; private readonly IOwinResponseMapper _responseMapper; -//#if !USE_ASPNETCORE -// public GlobalExceptionMiddleware(Next next, IWireMockMiddlewareOptions options, IOwinResponseMapper responseMapper) : base(next) -// { -// _options = Guard.NotNull(options); -// _responseMapper = Guard.NotNull(responseMapper);; -// } -//#else public GlobalExceptionMiddleware(RequestDelegate next, IWireMockMiddlewareOptions options, IOwinResponseMapper responseMapper) { Next = next; _options = Guard.NotNull(options); _responseMapper = Guard.NotNull(responseMapper); } -//#endif -//#if USE_ASPNETCORE public RequestDelegate? Next { get; } -//#endif -//#if !USE_ASPNETCORE -// public override Task Invoke(IContext ctx) -//#else public Task Invoke(HttpContext ctx) -//#endif { return InvokeInternalAsync(ctx); } diff --git a/src/WireMock.Net.Minimal/Server/WireMockServer.Admin.cs b/src/WireMock.Net.Minimal/Server/WireMockServer.Admin.cs index 073c6ac5..f4434811 100644 --- a/src/WireMock.Net.Minimal/Server/WireMockServer.Admin.cs +++ b/src/WireMock.Net.Minimal/Server/WireMockServer.Admin.cs @@ -295,11 +295,9 @@ public partial class WireMockServer WatchStaticMappings = _settings.WatchStaticMappings, WatchStaticMappingsInSubdirectories = _settings.WatchStaticMappingsInSubdirectories, -//#if USE_ASPNETCORE AcceptAnyClientCertificate = _settings.AcceptAnyClientCertificate, ClientCertificateMode = _settings.ClientCertificateMode, CorsPolicyOptions = _settings.CorsPolicyOptions?.ToString() -//#endif }; model.ProxyAndRecordSettings = TinyMapperUtils.Instance.Map(_settings.ProxyAndRecordSettings);