From 42882c818f99334cb4e7ed0c56fe2a35553a67e2 Mon Sep 17 00:00:00 2001 From: Stef Heyenrath Date: Wed, 9 Mar 2022 20:37:29 +0100 Subject: [PATCH] Remove interface for all Settings --- src/WireMock.Net.StandAlone/StandAloneApp.cs | 6 +- src/WireMock.Net/Http/HttpClientBuilder.cs | 2 +- src/WireMock.Net/Http/WebhookSender.cs | 4 +- src/WireMock.Net/IMapping.cs | 6 +- src/WireMock.Net/Mapping.cs | 4 +- src/WireMock.Net/Proxy/ProxyHelper.cs | 8 +- .../ResponseBuilders/IProxyResponseBuilder.cs | 4 +- .../IStatusCodeResponseBuilder.cs | 6 +- .../ResponseBuilders/Response.WithProxy.cs | 6 +- src/WireMock.Net/ResponseBuilders/Response.cs | 4 +- .../DynamicAsyncResponseProvider.cs | 2 +- .../DynamicResponseProvider.cs | 4 +- .../ResponseProviders/IResponseProvider.cs | 2 +- .../ProxyAsyncResponseProvider.cs | 8 +- .../Serialization/MappingConverter.cs | 2 +- .../Serialization/MappingToFileSaver.cs | 4 +- .../Serialization/MatcherMapper.cs | 6 +- .../Server/RespondWithAProvider.cs | 4 +- .../Server/WireMockServer.Admin.cs | 4 +- src/WireMock.Net/Server/WireMockServer.cs | 6 +- .../Settings/HttpClientSettings.cs | 19 +- .../Settings/IHttpClientSettings.cs | 24 -- .../Settings/IProxyAndRecordSettings.cs | 42 --- .../Settings/IWebProxySettings.cs | 23 -- src/WireMock.Net/Settings/IWebhookSettings.cs | 9 - .../Settings/IWireMockCertificateSettings.cs | 44 ---- .../Settings/IWireMockServerSettings.cs | 249 ------------------ .../Settings/ProxyAndRecordSettings.cs | 12 +- src/WireMock.Net/Settings/WebProxySettings.cs | 20 +- src/WireMock.Net/Settings/WebhookSettings.cs | 4 +- .../Settings/WireMockCertificateSettings.cs | 34 ++- .../Settings/WireMockServerSettings.cs | 161 ++++++++--- .../Settings/WireMockServerSettingsParser.cs | 14 +- .../ResponseWithStatusCodeTests.cs | 2 +- 34 files changed, 238 insertions(+), 511 deletions(-) delete mode 100644 src/WireMock.Net/Settings/IHttpClientSettings.cs delete mode 100644 src/WireMock.Net/Settings/IProxyAndRecordSettings.cs delete mode 100644 src/WireMock.Net/Settings/IWebProxySettings.cs delete mode 100644 src/WireMock.Net/Settings/IWebhookSettings.cs delete mode 100644 src/WireMock.Net/Settings/IWireMockCertificateSettings.cs delete mode 100644 src/WireMock.Net/Settings/IWireMockServerSettings.cs diff --git a/src/WireMock.Net.StandAlone/StandAloneApp.cs b/src/WireMock.Net.StandAlone/StandAloneApp.cs index 73a5b4d6b..3cc5b05a0 100644 --- a/src/WireMock.Net.StandAlone/StandAloneApp.cs +++ b/src/WireMock.Net.StandAlone/StandAloneApp.cs @@ -16,11 +16,11 @@ public static class StandAloneApp private static readonly string Version = typeof(StandAloneApp).GetTypeInfo().Assembly.GetName().Version.ToString(); /// - /// Start WireMock.Net standalone Server based on the IWireMockServerSettings. + /// Start WireMock.Net standalone Server based on the WireMockServerSettings. /// - /// The IWireMockServerSettings + /// The WireMockServerSettings [PublicAPI] - public static WireMockServer Start([NotNull] IWireMockServerSettings settings) + public static WireMockServer Start([NotNull] WireMockServerSettings settings) { Guard.NotNull(settings, nameof(settings)); diff --git a/src/WireMock.Net/Http/HttpClientBuilder.cs b/src/WireMock.Net/Http/HttpClientBuilder.cs index 3b72e305b..5b270c357 100644 --- a/src/WireMock.Net/Http/HttpClientBuilder.cs +++ b/src/WireMock.Net/Http/HttpClientBuilder.cs @@ -7,7 +7,7 @@ namespace WireMock.Http { internal static class HttpClientBuilder { - public static HttpClient Build(IHttpClientSettings settings) + public static HttpClient Build(HttpClientSettings settings) { #if NETSTANDARD || NETCOREAPP3_1 || NET5_0 || NET6_0 var handler = new HttpClientHandler diff --git a/src/WireMock.Net/Http/WebhookSender.cs b/src/WireMock.Net/Http/WebhookSender.cs index 0a054c33a..aa18eb6d7 100644 --- a/src/WireMock.Net/Http/WebhookSender.cs +++ b/src/WireMock.Net/Http/WebhookSender.cs @@ -19,9 +19,9 @@ internal class WebhookSender { private const string ClientIp = "::1"; - private readonly IWireMockServerSettings _settings; + private readonly WireMockServerSettings _settings; - public WebhookSender(IWireMockServerSettings settings) + public WebhookSender(WireMockServerSettings settings) { _settings = settings ?? throw new ArgumentNullException(nameof(settings)); } diff --git a/src/WireMock.Net/IMapping.cs b/src/WireMock.Net/IMapping.cs index 510c31110..cb39f320b 100644 --- a/src/WireMock.Net/IMapping.cs +++ b/src/WireMock.Net/IMapping.cs @@ -76,8 +76,8 @@ public interface IMapping /// /// The WireMockServerSettings. /// - IWireMockServerSettings Settings { get; } - + WireMockServerSettings Settings { get; } + /// /// Is State started ? /// @@ -90,7 +90,7 @@ public interface IMapping /// true if this mapping is an Admin Interface; otherwise, false. /// bool IsAdminInterface { get; } - + /// /// Gets a value indicating whether this mapping to be logged. /// diff --git a/src/WireMock.Net/Mapping.cs b/src/WireMock.Net/Mapping.cs index 2fa77e006..65fe03c9e 100644 --- a/src/WireMock.Net/Mapping.cs +++ b/src/WireMock.Net/Mapping.cs @@ -44,7 +44,7 @@ public class Mapping : IMapping public IResponseProvider Provider { get; } /// - public IWireMockServerSettings Settings { get; } + public WireMockServerSettings Settings { get; } /// public bool IsStartState => Scenario == null || Scenario != null && NextState != null && ExecutionConditionState == null; @@ -81,7 +81,7 @@ public Mapping( Guid guid, [CanBeNull] string title, [CanBeNull] string path, - [NotNull] IWireMockServerSettings settings, + [NotNull] WireMockServerSettings settings, [NotNull] IRequestMatcher requestMatcher, [NotNull] IResponseProvider provider, int priority, diff --git a/src/WireMock.Net/Proxy/ProxyHelper.cs b/src/WireMock.Net/Proxy/ProxyHelper.cs index 5da5874f3..a833989af 100644 --- a/src/WireMock.Net/Proxy/ProxyHelper.cs +++ b/src/WireMock.Net/Proxy/ProxyHelper.cs @@ -17,15 +17,15 @@ namespace WireMock.Proxy { internal class ProxyHelper { - private readonly IWireMockServerSettings _settings; + private readonly WireMockServerSettings _settings; - public ProxyHelper([NotNull] IWireMockServerSettings settings) + public ProxyHelper([NotNull] WireMockServerSettings settings) { _settings = Guard.NotNull(settings, nameof(settings)); } public async Task<(ResponseMessage Message, IMapping Mapping)> SendAsync( - [NotNull] IProxyAndRecordSettings proxyAndRecordSettings, + [NotNull] ProxyAndRecordSettings proxyAndRecordSettings, [NotNull] HttpClient client, [NotNull] RequestMessage requestMessage, [NotNull] string url) @@ -59,7 +59,7 @@ public ProxyHelper([NotNull] IWireMockServerSettings settings) return (responseMessage, mapping); } - private IMapping ToMapping(IProxyAndRecordSettings proxyAndRecordSettings, RequestMessage requestMessage, ResponseMessage responseMessage) + private IMapping ToMapping(ProxyAndRecordSettings proxyAndRecordSettings, RequestMessage requestMessage, ResponseMessage responseMessage) { string[] excludedHeaders = proxyAndRecordSettings.ExcludedHeaders ?? new string[] { }; string[] excludedCookies = proxyAndRecordSettings.ExcludedCookies ?? new string[] { }; diff --git a/src/WireMock.Net/ResponseBuilders/IProxyResponseBuilder.cs b/src/WireMock.Net/ResponseBuilders/IProxyResponseBuilder.cs index d8399cf10..13820531a 100644 --- a/src/WireMock.Net/ResponseBuilders/IProxyResponseBuilder.cs +++ b/src/WireMock.Net/ResponseBuilders/IProxyResponseBuilder.cs @@ -1,4 +1,4 @@ -using JetBrains.Annotations; +using JetBrains.Annotations; using WireMock.Settings; namespace WireMock.ResponseBuilders @@ -21,6 +21,6 @@ public interface IProxyResponseBuilder : IStatusCodeResponseBuilder /// /// The IProxyAndRecordSettings. /// A . - IResponseBuilder WithProxy([NotNull] IProxyAndRecordSettings settings); + IResponseBuilder WithProxy([NotNull] ProxyAndRecordSettings settings); } } \ No newline at end of file diff --git a/src/WireMock.Net/ResponseBuilders/IStatusCodeResponseBuilder.cs b/src/WireMock.Net/ResponseBuilders/IStatusCodeResponseBuilder.cs index 5bcda2e1a..e09e9fd19 100644 --- a/src/WireMock.Net/ResponseBuilders/IStatusCodeResponseBuilder.cs +++ b/src/WireMock.Net/ResponseBuilders/IStatusCodeResponseBuilder.cs @@ -10,7 +10,7 @@ public interface IStatusCodeResponseBuilder : IHeadersResponseBuilder { /// /// The with status code. - /// By default all status codes are allowed, to change this behaviour, see . + /// By default all status codes are allowed, to change this behaviour, see . /// /// The code. /// The . @@ -18,7 +18,7 @@ public interface IStatusCodeResponseBuilder : IHeadersResponseBuilder /// /// The with status code. - /// By default all status codes are allowed, to change this behaviour, see . + /// By default all status codes are allowed, to change this behaviour, see . /// /// The code. /// The . @@ -26,7 +26,7 @@ public interface IStatusCodeResponseBuilder : IHeadersResponseBuilder /// /// The with status code. - /// By default all status codes are allowed, to change this behaviour, see . + /// By default all status codes are allowed, to change this behaviour, see . /// /// The code. /// The . diff --git a/src/WireMock.Net/ResponseBuilders/Response.WithProxy.cs b/src/WireMock.Net/ResponseBuilders/Response.WithProxy.cs index d1c713863..28b2c24b6 100644 --- a/src/WireMock.Net/ResponseBuilders/Response.WithProxy.cs +++ b/src/WireMock.Net/ResponseBuilders/Response.WithProxy.cs @@ -1,4 +1,4 @@ -using System.Net.Http; +using System.Net.Http; using WireMock.Http; using WireMock.Settings; using Stef.Validation; @@ -12,7 +12,7 @@ public partial class Response /// /// The WebProxy settings. /// - public IProxyAndRecordSettings ProxyAndRecordSettings { get; private set; } + public ProxyAndRecordSettings ProxyAndRecordSettings { get; private set; } /// public IResponseBuilder WithProxy(string proxyUrl, string clientX509Certificate2ThumbprintOrSubjectName = null) @@ -29,7 +29,7 @@ public IResponseBuilder WithProxy(string proxyUrl, string clientX509Certificate2 } /// - public IResponseBuilder WithProxy(IProxyAndRecordSettings settings) + public IResponseBuilder WithProxy(ProxyAndRecordSettings settings) { Guard.NotNull(settings, nameof(settings)); diff --git a/src/WireMock.Net/ResponseBuilders/Response.cs b/src/WireMock.Net/ResponseBuilders/Response.cs index 65f9da323..b213dc232 100644 --- a/src/WireMock.Net/ResponseBuilders/Response.cs +++ b/src/WireMock.Net/ResponseBuilders/Response.cs @@ -385,8 +385,8 @@ public IResponseBuilder WithRandomDelay(int minimumMilliseconds = 0, int maximum return this; } - /// - public async Task<(ResponseMessage Message, IMapping Mapping)> ProvideResponseAsync(RequestMessage requestMessage, IWireMockServerSettings settings) + /// + public async Task<(ResponseMessage Message, IMapping Mapping)> ProvideResponseAsync(RequestMessage requestMessage, WireMockServerSettings settings) { Guard.NotNull(requestMessage, nameof(requestMessage)); Guard.NotNull(settings, nameof(settings)); diff --git a/src/WireMock.Net/ResponseProviders/DynamicAsyncResponseProvider.cs b/src/WireMock.Net/ResponseProviders/DynamicAsyncResponseProvider.cs index c9e84166d..d29fbe3b2 100644 --- a/src/WireMock.Net/ResponseProviders/DynamicAsyncResponseProvider.cs +++ b/src/WireMock.Net/ResponseProviders/DynamicAsyncResponseProvider.cs @@ -13,7 +13,7 @@ public DynamicAsyncResponseProvider(Func> _responseMessageFunc = responseMessageFunc; } - public async Task<(ResponseMessage Message, IMapping Mapping)> ProvideResponseAsync(RequestMessage requestMessage, IWireMockServerSettings settings) + public async Task<(ResponseMessage Message, IMapping Mapping)> ProvideResponseAsync(RequestMessage requestMessage, WireMockServerSettings settings) { return (await _responseMessageFunc(requestMessage).ConfigureAwait(false), null); } diff --git a/src/WireMock.Net/ResponseProviders/DynamicResponseProvider.cs b/src/WireMock.Net/ResponseProviders/DynamicResponseProvider.cs index 2ec19ebcc..d0b97c2d8 100644 --- a/src/WireMock.Net/ResponseProviders/DynamicResponseProvider.cs +++ b/src/WireMock.Net/ResponseProviders/DynamicResponseProvider.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Threading.Tasks; using WireMock.Settings; @@ -13,7 +13,7 @@ public DynamicResponseProvider(Func responseMes _responseMessageFunc = responseMessageFunc; } - public Task<(ResponseMessage Message, IMapping Mapping)> ProvideResponseAsync(RequestMessage requestMessage, IWireMockServerSettings settings) + public Task<(ResponseMessage Message, IMapping Mapping)> ProvideResponseAsync(RequestMessage requestMessage, WireMockServerSettings settings) { (ResponseMessage responseMessage, IMapping mapping) result = (_responseMessageFunc(requestMessage), null); return Task.FromResult(result); diff --git a/src/WireMock.Net/ResponseProviders/IResponseProvider.cs b/src/WireMock.Net/ResponseProviders/IResponseProvider.cs index 16eaae64c..a541b5f27 100644 --- a/src/WireMock.Net/ResponseProviders/IResponseProvider.cs +++ b/src/WireMock.Net/ResponseProviders/IResponseProvider.cs @@ -17,6 +17,6 @@ public interface IResponseProvider /// The request. /// The WireMockServerSettings. /// The including a new (optional) . - Task<(ResponseMessage Message, IMapping Mapping)> ProvideResponseAsync([NotNull] RequestMessage requestMessage, [NotNull] IWireMockServerSettings settings); + Task<(ResponseMessage Message, IMapping Mapping)> ProvideResponseAsync([NotNull] RequestMessage requestMessage, [NotNull] WireMockServerSettings settings); } } \ No newline at end of file diff --git a/src/WireMock.Net/ResponseProviders/ProxyAsyncResponseProvider.cs b/src/WireMock.Net/ResponseProviders/ProxyAsyncResponseProvider.cs index d1083aa9a..bdc6d537d 100644 --- a/src/WireMock.Net/ResponseProviders/ProxyAsyncResponseProvider.cs +++ b/src/WireMock.Net/ResponseProviders/ProxyAsyncResponseProvider.cs @@ -6,16 +6,16 @@ namespace WireMock.ResponseProviders { internal class ProxyAsyncResponseProvider : IResponseProvider { - private readonly Func> _responseMessageFunc; - private readonly IWireMockServerSettings _settings; + private readonly Func> _responseMessageFunc; + private readonly WireMockServerSettings _settings; - public ProxyAsyncResponseProvider(Func> responseMessageFunc, IWireMockServerSettings settings) + public ProxyAsyncResponseProvider(Func> responseMessageFunc, WireMockServerSettings settings) { _responseMessageFunc = responseMessageFunc; _settings = settings; } - public async Task<(ResponseMessage Message, IMapping Mapping)> ProvideResponseAsync(RequestMessage requestMessage, IWireMockServerSettings settings) + public async Task<(ResponseMessage Message, IMapping Mapping)> ProvideResponseAsync(RequestMessage requestMessage, WireMockServerSettings settings) { return (await _responseMessageFunc(requestMessage, _settings).ConfigureAwait(false), null); } diff --git a/src/WireMock.Net/Serialization/MappingConverter.cs b/src/WireMock.Net/Serialization/MappingConverter.cs index 26f334fbb..d8698ce2a 100644 --- a/src/WireMock.Net/Serialization/MappingConverter.cs +++ b/src/WireMock.Net/Serialization/MappingConverter.cs @@ -209,7 +209,7 @@ public MappingModel ToMappingModel(IMapping mapping) return mappingModel; } - private static WebProxyModel MapWebProxy(IWebProxySettings settings) + private static WebProxyModel MapWebProxy(WebProxySettings settings) { return settings != null ? new WebProxyModel { diff --git a/src/WireMock.Net/Serialization/MappingToFileSaver.cs b/src/WireMock.Net/Serialization/MappingToFileSaver.cs index 1d5a09542..a4e3b068e 100644 --- a/src/WireMock.Net/Serialization/MappingToFileSaver.cs +++ b/src/WireMock.Net/Serialization/MappingToFileSaver.cs @@ -8,10 +8,10 @@ namespace WireMock.Serialization { internal class MappingToFileSaver { - private readonly IWireMockServerSettings _settings; + private readonly WireMockServerSettings _settings; private readonly MappingConverter _mappingConverter; - public MappingToFileSaver(IWireMockServerSettings settings, MappingConverter mappingConverter) + public MappingToFileSaver(WireMockServerSettings settings, MappingConverter mappingConverter) { Guard.NotNull(settings, nameof(settings)); diff --git a/src/WireMock.Net/Serialization/MatcherMapper.cs b/src/WireMock.Net/Serialization/MatcherMapper.cs index 48090d3d2..621d4d54d 100644 --- a/src/WireMock.Net/Serialization/MatcherMapper.cs +++ b/src/WireMock.Net/Serialization/MatcherMapper.cs @@ -15,9 +15,9 @@ namespace WireMock.Serialization { internal class MatcherMapper { - private readonly IWireMockServerSettings _settings; + private readonly WireMockServerSettings _settings; - public MatcherMapper(IWireMockServerSettings settings) + public MatcherMapper(WireMockServerSettings settings) { _settings = settings ?? throw new ArgumentNullException(nameof(settings)); } @@ -54,7 +54,7 @@ public IMatcher Map([CanBeNull] MatcherModel matcher) return PluginLoader.Load(matchBehaviour, stringPatterns); } - throw new NotSupportedException("It's not allowed to use the 'CSharpCodeMatcher' because IWireMockServerSettings.AllowCSharpCodeMatcher is not set to 'true'."); + throw new NotSupportedException("It's not allowed to use the 'CSharpCodeMatcher' because WireMockServerSettings.AllowCSharpCodeMatcher is not set to 'true'."); case nameof(LinqMatcher): return new LinqMatcher(matchBehaviour, throwExceptionWhenMatcherFails, stringPatterns); diff --git a/src/WireMock.Net/Server/RespondWithAProvider.cs b/src/WireMock.Net/Server/RespondWithAProvider.cs index ab1eb115c..c755156c8 100644 --- a/src/WireMock.Net/Server/RespondWithAProvider.cs +++ b/src/WireMock.Net/Server/RespondWithAProvider.cs @@ -27,7 +27,7 @@ internal class RespondWithAProvider : IRespondWithAProvider private int _timesInSameState = 1; private readonly RegistrationCallback _registrationCallback; private readonly IRequestMatcher _requestMatcher; - private readonly IWireMockServerSettings _settings; + private readonly WireMockServerSettings _settings; private readonly bool _saveToFile; public Guid Guid { get; private set; } = Guid.NewGuid(); @@ -43,7 +43,7 @@ internal class RespondWithAProvider : IRespondWithAProvider /// The request matcher. /// The WireMockServerSettings. /// Optional boolean to indicate if this mapping should be saved as static mapping file. - public RespondWithAProvider(RegistrationCallback registrationCallback, IRequestMatcher requestMatcher, IWireMockServerSettings settings, bool saveToFile = false) + public RespondWithAProvider(RegistrationCallback registrationCallback, IRequestMatcher requestMatcher, WireMockServerSettings settings, bool saveToFile = false) { _registrationCallback = registrationCallback; _requestMatcher = requestMatcher; diff --git a/src/WireMock.Net/Server/WireMockServer.Admin.cs b/src/WireMock.Net/Server/WireMockServer.Admin.cs index c87f5c4b8..503fc2ce7 100644 --- a/src/WireMock.Net/Server/WireMockServer.Admin.cs +++ b/src/WireMock.Net/Server/WireMockServer.Admin.cs @@ -209,7 +209,7 @@ public bool ReadStaticMappingAndAddOrUpdate([NotNull] string path) #region Proxy and Record private HttpClient _httpClientForProxy; - private void InitProxyAndRecord(IWireMockServerSettings settings) + private void InitProxyAndRecord(WireMockServerSettings settings) { _httpClientForProxy = HttpClientBuilder.Build(settings.ProxyAndRecordSettings); @@ -222,7 +222,7 @@ private void InitProxyAndRecord(IWireMockServerSettings settings) respondProvider.RespondWith(new ProxyAsyncResponseProvider(ProxyAndRecordAsync, settings)); } - private async Task ProxyAndRecordAsync(RequestMessage requestMessage, IWireMockServerSettings settings) + private async Task ProxyAndRecordAsync(RequestMessage requestMessage, WireMockServerSettings settings) { var requestUri = new Uri(requestMessage.Url); var proxyUri = new Uri(settings.ProxyAndRecordSettings.Url); diff --git a/src/WireMock.Net/Server/WireMockServer.cs b/src/WireMock.Net/Server/WireMockServer.cs index 219e15199..de97a02e0 100644 --- a/src/WireMock.Net/Server/WireMockServer.cs +++ b/src/WireMock.Net/Server/WireMockServer.cs @@ -29,7 +29,7 @@ public partial class WireMockServer : IWireMockServer { private const int ServerStartDelayInMs = 100; - private readonly IWireMockServerSettings _settings; + private readonly WireMockServerSettings _settings; private readonly IOwinSelfHost _httpServer; private readonly IWireMockMiddlewareOptions _options = new WireMockMiddlewareOptions(); private readonly MappingConverter _mappingConverter; @@ -92,7 +92,7 @@ protected virtual void Dispose(bool disposing) /// The WireMockServerSettings. /// The . [PublicAPI] - public static WireMockServer Start([NotNull] IWireMockServerSettings settings) + public static WireMockServer Start([NotNull] WireMockServerSettings settings) { Guard.NotNull(settings, nameof(settings)); @@ -193,7 +193,7 @@ public static WireMockServer StartWithAdminInterfaceAndReadStaticMappings(params /// Service start failed with error: {startTask.Exception.Message} /// /// Service start timed out after {TimeSpan.FromMilliseconds(settings.StartTimeout)} - protected WireMockServer(IWireMockServerSettings settings) + protected WireMockServer(WireMockServerSettings settings) { _settings = settings; diff --git a/src/WireMock.Net/Settings/HttpClientSettings.cs b/src/WireMock.Net/Settings/HttpClientSettings.cs index ab9e20500..3db6a206c 100644 --- a/src/WireMock.Net/Settings/HttpClientSettings.cs +++ b/src/WireMock.Net/Settings/HttpClientSettings.cs @@ -1,17 +1,24 @@ -namespace WireMock.Settings +namespace WireMock.Settings { /// /// HttpClientSettings /// - public class HttpClientSettings : IHttpClientSettings + public class HttpClientSettings { - /// + /// + /// The clientCertificate thumbprint or subject name fragment to use. + /// Example thumbprint : "D2DBF135A8D06ACCD0E1FAD9BFB28678DF7A9818". Example subject name: "www.google.com"" + /// public string ClientX509Certificate2ThumbprintOrSubjectName { get; set; } - /// - public IWebProxySettings WebProxySettings { get; set; } + /// + /// Defines the WebProxySettings. + /// + public WebProxySettings WebProxySettings { get; set; } - /// + /// + /// Proxy requests should follow redirection (30x). + /// public bool? AllowAutoRedirect { get; set; } } } \ No newline at end of file diff --git a/src/WireMock.Net/Settings/IHttpClientSettings.cs b/src/WireMock.Net/Settings/IHttpClientSettings.cs deleted file mode 100644 index 82a9d9c2f..000000000 --- a/src/WireMock.Net/Settings/IHttpClientSettings.cs +++ /dev/null @@ -1,24 +0,0 @@ -namespace WireMock.Settings -{ - /// - /// IHttpClientSettings - /// - public interface IHttpClientSettings - { - /// - /// The clientCertificate thumbprint or subject name fragment to use. - /// Example thumbprint : "D2DBF135A8D06ACCD0E1FAD9BFB28678DF7A9818". Example subject name: "www.google.com"" - /// - string ClientX509Certificate2ThumbprintOrSubjectName { get; set; } - - /// - /// Defines the WebProxySettings. - /// - IWebProxySettings WebProxySettings { get; set; } - - /// - /// Proxy requests should follow redirection (30x). - /// - bool? AllowAutoRedirect { get; set; } - } -} \ No newline at end of file diff --git a/src/WireMock.Net/Settings/IProxyAndRecordSettings.cs b/src/WireMock.Net/Settings/IProxyAndRecordSettings.cs deleted file mode 100644 index 2e10128e4..000000000 --- a/src/WireMock.Net/Settings/IProxyAndRecordSettings.cs +++ /dev/null @@ -1,42 +0,0 @@ -using JetBrains.Annotations; - -namespace WireMock.Settings -{ - /// - /// IProxyAndRecordSettings - /// - public interface IProxyAndRecordSettings : IHttpClientSettings - { - /// - /// The URL to proxy. - /// - string Url { get; set; } - - /// - /// Save the mapping for each request/response to the internal Mappings. - /// - bool SaveMapping { get; set; } - - /// - /// Only save request/response to the internal Mappings if the status code is included in this pattern. (Note that SaveMapping must also be set to true.) - /// The pattern can contain a single value like "200", but also ranges like "2xx", "100,300,600" or "100-299,6xx" are supported. - /// - [CanBeNull] - string SaveMappingForStatusCodePattern { get; set; } - - /// - /// Save the mapping for each request/response to a .json mapping file. - /// - bool SaveMappingToFile { get; set; } - - /// - /// Defines a list from headers which will be excluded from the saved mappings. - /// - string[] ExcludedHeaders { get; set; } - - /// - /// Defines a list of cookies which will be excluded from the saved mappings. - /// - string[] ExcludedCookies { get; set; } - } -} \ No newline at end of file diff --git a/src/WireMock.Net/Settings/IWebProxySettings.cs b/src/WireMock.Net/Settings/IWebProxySettings.cs deleted file mode 100644 index 4c25e3f26..000000000 --- a/src/WireMock.Net/Settings/IWebProxySettings.cs +++ /dev/null @@ -1,23 +0,0 @@ -namespace WireMock.Settings -{ - /// - /// IWebProxySettings - /// - public interface IWebProxySettings - { - /// - /// A string instance that contains the address of the proxy server. - /// - string Address { get; set; } - - /// - /// The user name associated with the credentials. - /// - string UserName { get; set; } - - /// - /// The password for the user name associated with the credentials. - /// - string Password { get; set; } - } -} diff --git a/src/WireMock.Net/Settings/IWebhookSettings.cs b/src/WireMock.Net/Settings/IWebhookSettings.cs deleted file mode 100644 index ea4a5777c..000000000 --- a/src/WireMock.Net/Settings/IWebhookSettings.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace WireMock.Settings -{ - /// - /// IWebhookSettings - /// - public interface IWebhookSettings : IHttpClientSettings - { - } -} \ No newline at end of file diff --git a/src/WireMock.Net/Settings/IWireMockCertificateSettings.cs b/src/WireMock.Net/Settings/IWireMockCertificateSettings.cs deleted file mode 100644 index d2d476bb4..000000000 --- a/src/WireMock.Net/Settings/IWireMockCertificateSettings.cs +++ /dev/null @@ -1,44 +0,0 @@ -namespace WireMock.Settings -{ - /// - /// If https is used, these settings can be used to configure the CertificateSettings in case a custom certificate instead the default .NET certificate should be used. - /// - /// X509StoreName and X509StoreLocation should be defined - /// OR - /// X509CertificateFilePath and X509CertificatePassword should be defined - /// - public interface IWireMockCertificateSettings - { - /// - /// X509 StoreName (AddressBook, AuthRoot, CertificateAuthority, My, Root, TrustedPeople or TrustedPublisher) - /// - string X509StoreName { get; set; } - - /// - /// X509 StoreLocation (CurrentUser or LocalMachine) - /// - string X509StoreLocation { get; set; } - - /// - /// X509 Thumbprint or SubjectName (if not defined, the 'host' is used) - /// - string X509StoreThumbprintOrSubjectName { get; set; } - - /// - /// X509Certificate FilePath - /// - string X509CertificateFilePath { get; set; } - - /// - /// X509Certificate Password - /// - string X509CertificatePassword { get; set; } - - /// - /// X509StoreName and X509StoreLocation should be defined - /// OR - /// X509CertificateFilePath and X509CertificatePassword should be defined - /// - bool IsDefined { get; } - } -} \ No newline at end of file diff --git a/src/WireMock.Net/Settings/IWireMockServerSettings.cs b/src/WireMock.Net/Settings/IWireMockServerSettings.cs deleted file mode 100644 index 624fc68fc..000000000 --- a/src/WireMock.Net/Settings/IWireMockServerSettings.cs +++ /dev/null @@ -1,249 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text.RegularExpressions; -using HandlebarsDotNet; -using JetBrains.Annotations; -using Newtonsoft.Json; -using WireMock.Admin.Mappings; -using WireMock.Handlers; -using WireMock.Logging; -using WireMock.Matchers; -using WireMock.RegularExpressions; -#if USE_ASPNETCORE -using Microsoft.Extensions.DependencyInjection; -using WireMock.Types; -#endif - -namespace WireMock.Settings -{ - /// - /// IWireMockServerSettings - /// - public interface IWireMockServerSettings - { - /// - /// Gets or sets the port. - /// - [PublicAPI] - int? Port { get; set; } - - /// - /// Gets or sets the use SSL. - /// - // ReSharper disable once InconsistentNaming - [PublicAPI] - bool? UseSSL { get; set; } - - /// - /// Gets or sets whether to start admin interface. - /// - [PublicAPI] - bool? StartAdminInterface { get; set; } - - /// - /// Gets or sets if the static mappings should be read at startup. - /// - [PublicAPI] - bool? ReadStaticMappings { get; set; } - - /// - /// Watch the static mapping files + folder for changes when running. - /// - [PublicAPI] - bool? WatchStaticMappings { get; set; } - - /// - /// A value indicating whether subdirectories within the static mappings path should be monitored. - /// - [PublicAPI] - bool? WatchStaticMappingsInSubdirectories { get; set; } - - /// - /// Gets or sets if the proxy and record settings. - /// - [PublicAPI] - IProxyAndRecordSettings ProxyAndRecordSettings { get; set; } - - /// - /// Gets or sets the urls. - /// - [PublicAPI] - string[] Urls { get; set; } - - /// - /// StartTimeout - /// - [PublicAPI] - int StartTimeout { get; set; } - - /// - /// Allow Partial Mapping (default set to false). - /// - [PublicAPI] - bool? AllowPartialMapping { get; set; } - - /// - /// The username needed for __admin access. - /// - [PublicAPI] - string AdminUsername { get; set; } - - /// - /// The password needed for __admin access. - /// - [PublicAPI] - string AdminPassword { get; set; } - - /// - /// The AzureAD Tenant needed for __admin access. - /// - [PublicAPI] - string AdminAzureADTenant { get; set; } - - /// - /// The AzureAD Audience / Resource for __admin access. - /// - [PublicAPI] - string AdminAzureADAudience { get; set; } - - /// - /// The RequestLog expiration in hours (optional). - /// - [PublicAPI] - int? RequestLogExpirationDuration { get; set; } - - /// - /// The MaxRequestLog count (optional). - /// - [PublicAPI] - int? MaxRequestLogCount { get; set; } - - /// - /// Action which is called (with the IAppBuilder or IApplicationBuilder) before the internal WireMockMiddleware is initialized. [Optional] - /// - [PublicAPI] - Action PreWireMockMiddlewareInit { get; set; } - - /// - /// Action which is called (with the IAppBuilder or IApplicationBuilder) after the internal WireMockMiddleware is initialized. [Optional] - /// - [PublicAPI] - Action PostWireMockMiddlewareInit { get; set; } - -#if USE_ASPNETCORE - /// - /// Action which is called with IServiceCollection when ASP.NET Core DI is being configured. [Optional] - /// - [PublicAPI] - Action AdditionalServiceRegistration { get; set; } - - /// - /// Policies to use when using CORS. By default CORS is disabled. [Optional] - /// - [PublicAPI] - CorsPolicyOptions? CorsPolicyOptions { get; set; } -#endif - - /// - /// The IWireMockLogger which logs Debug, Info, Warning or Error - /// - [PublicAPI] - IWireMockLogger Logger { get; set; } - - /// - /// Handler to interact with the file system to read and write static mapping files. - /// - [PublicAPI] - IFileSystemHandler FileSystemHandler { get; set; } - - /// - /// Action which can be used to add additional Handlebars registrations. [Optional] - /// - [PublicAPI] - Action HandlebarsRegistrationCallback { get; set; } - - /// - /// Allow the usage of CSharpCodeMatcher (default is not allowed). - /// - [PublicAPI] - bool? AllowCSharpCodeMatcher { get; set; } - - /// - /// Allow a Body for all HTTP Methods. (default set to false). - /// - [PublicAPI] - bool? AllowBodyForAllHttpMethods { get; set; } - - /// - /// Allow only a HttpStatus Code in the response which is defined. (default set to false). - /// - false : also null, 0, empty or invalid HttpStatus codes are allowed. - /// - true : only codes defined in are allowed. - /// - [PublicAPI] - bool? AllowOnlyDefinedHttpStatusCodeInResponse { get; set; } - - /// - /// Set to true to disable Json deserialization when processing requests. (default set to false). - /// - [PublicAPI] - bool? DisableJsonBodyParsing { get; set; } - - /// - /// Disable support for GZip and Deflate request body decompression. (default set to false). - /// - [PublicAPI] - bool? DisableRequestBodyDecompressing { get; set; } - - /// - /// Handle all requests synchronously. (default set to false). - /// - [PublicAPI] - bool? HandleRequestsSynchronously { get; set; } - - /// - /// Throw an exception when the fails because of invalid input. (default set to false). - /// - [PublicAPI] - bool? ThrowExceptionWhenMatcherFails { get; set; } - - /// - /// If https is used, these settings can be used to configure the CertificateSettings in case a custom certificate instead the default .NET certificate should be used. - /// - /// X509StoreName and X509StoreLocation should be defined - /// OR - /// X509CertificateFilePath and X509CertificatePassword should be defined - /// - [PublicAPI] - IWireMockCertificateSettings CertificateSettings { get; set; } - - /// - /// Defines if custom CertificateSettings are defined - /// - [PublicAPI] - bool CustomCertificateDefined { get; } - - /// - /// Defines the global IWebhookSettings to use. - /// - [PublicAPI] - IWebhookSettings WebhookSettings { get; set; } - - /// - /// Use the instead of the default (default set to true). - /// - [PublicAPI] - bool? UseRegexExtended { get; set; } - - /// - /// Save unmatched requests to a file using the (default set to false). - /// - [PublicAPI] - bool? SaveUnmatchedRequests { get; set; } - - /// - /// Custom matcher mappings for static mappings - /// - [PublicAPI, JsonIgnore] - IDictionary> CustomMatcherMappings { get; set; } - } -} \ No newline at end of file diff --git a/src/WireMock.Net/Settings/ProxyAndRecordSettings.cs b/src/WireMock.Net/Settings/ProxyAndRecordSettings.cs index 1e3f57f93..1e9d95186 100644 --- a/src/WireMock.Net/Settings/ProxyAndRecordSettings.cs +++ b/src/WireMock.Net/Settings/ProxyAndRecordSettings.cs @@ -1,11 +1,11 @@ -using JetBrains.Annotations; +using JetBrains.Annotations; namespace WireMock.Settings { /// /// ProxyAndRecordSettings /// - public class ProxyAndRecordSettings : HttpClientSettings, IProxyAndRecordSettings + public class ProxyAndRecordSettings : HttpClientSettings { /// /// The URL to proxy. @@ -32,11 +32,15 @@ public class ProxyAndRecordSettings : HttpClientSettings, IProxyAndRecordSetting [PublicAPI] public string SaveMappingForStatusCodePattern { get; set; } = "*"; - /// + /// + /// Defines a list from headers which will be excluded from the saved mappings. + /// [PublicAPI] public string[] ExcludedHeaders { get; set; } - /// + /// + /// Defines a list of cookies which will be excluded from the saved mappings. + /// [PublicAPI] public string[] ExcludedCookies { get; set; } } diff --git a/src/WireMock.Net/Settings/WebProxySettings.cs b/src/WireMock.Net/Settings/WebProxySettings.cs index 96cf1b04a..b4e472303 100644 --- a/src/WireMock.Net/Settings/WebProxySettings.cs +++ b/src/WireMock.Net/Settings/WebProxySettings.cs @@ -1,19 +1,27 @@ -using JetBrains.Annotations; +using JetBrains.Annotations; namespace WireMock.Settings { - /// - public class WebProxySettings : IWebProxySettings + /// + /// WebProxySettings + /// + public class WebProxySettings { - /// + /// + /// A string instance that contains the address of the proxy server. + /// [PublicAPI] public string Address { get; set; } - /// + /// + /// The user name associated with the credentials. + /// [PublicAPI] public string UserName { get; set; } - /// + /// + /// The password for the user name associated with the credentials. + /// [PublicAPI] public string Password { get; set; } } diff --git a/src/WireMock.Net/Settings/WebhookSettings.cs b/src/WireMock.Net/Settings/WebhookSettings.cs index f0689d91e..5294fe82d 100644 --- a/src/WireMock.Net/Settings/WebhookSettings.cs +++ b/src/WireMock.Net/Settings/WebhookSettings.cs @@ -1,9 +1,9 @@ -namespace WireMock.Settings +namespace WireMock.Settings { /// /// WebhookSettings /// - public class WebhookSettings : HttpClientSettings, IWebhookSettings + public class WebhookSettings : HttpClientSettings { } } \ No newline at end of file diff --git a/src/WireMock.Net/Settings/WireMockCertificateSettings.cs b/src/WireMock.Net/Settings/WireMockCertificateSettings.cs index ebf27049a..eb5aadce0 100644 --- a/src/WireMock.Net/Settings/WireMockCertificateSettings.cs +++ b/src/WireMock.Net/Settings/WireMockCertificateSettings.cs @@ -3,31 +3,49 @@ namespace WireMock.Settings { /// - /// + /// If https is used, these settings can be used to configure the CertificateSettings in case a custom certificate instead the default .NET certificate should be used. + /// + /// X509StoreName and X509StoreLocation should be defined + /// OR + /// X509CertificateFilePath and X509CertificatePassword should be defined /// - public class WireMockCertificateSettings : IWireMockCertificateSettings + public class WireMockCertificateSettings { - /// + /// + /// X509 StoreName (AddressBook, AuthRoot, CertificateAuthority, My, Root, TrustedPeople or TrustedPublisher) + /// [PublicAPI] public string X509StoreName { get; set; } - /// + /// + /// X509 StoreLocation (CurrentUser or LocalMachine) + /// [PublicAPI] public string X509StoreLocation { get; set; } - /// + /// + /// X509 Thumbprint or SubjectName (if not defined, the 'host' is used) + /// [PublicAPI] public string X509StoreThumbprintOrSubjectName { get; set; } - /// + /// + /// X509Certificate FilePath + /// [PublicAPI] public string X509CertificateFilePath { get; set; } - /// + /// + /// X509Certificate Password + /// [PublicAPI] public string X509CertificatePassword { get; set; } - /// + /// + /// X509StoreName and X509StoreLocation should be defined + /// OR + /// X509CertificateFilePath and X509CertificatePassword should be defined + /// [PublicAPI] public bool IsDefined => !string.IsNullOrEmpty(X509StoreName) && !string.IsNullOrEmpty(X509StoreLocation) || diff --git a/src/WireMock.Net/Settings/WireMockServerSettings.cs b/src/WireMock.Net/Settings/WireMockServerSettings.cs index 7bf35c939..3ada4a701 100644 --- a/src/WireMock.Net/Settings/WireMockServerSettings.cs +++ b/src/WireMock.Net/Settings/WireMockServerSettings.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Text.RegularExpressions; using HandlebarsDotNet; using JetBrains.Annotations; using Newtonsoft.Json; @@ -7,6 +8,7 @@ using WireMock.Handlers; using WireMock.Logging; using WireMock.Matchers; +using WireMock.RegularExpressions; using WireMock.Types; #if USE_ASPNETCORE using Microsoft.Extensions.DependencyInjection; @@ -17,157 +19,236 @@ namespace WireMock.Settings /// /// WireMockServerSettings /// - public class WireMockServerSettings : IWireMockServerSettings + public class WireMockServerSettings { - /// + /// + /// Gets or sets the port. + /// [PublicAPI] public int? Port { get; set; } - /// + /// + /// Gets or sets the use SSL. + /// + // ReSharper disable once InconsistentNaming [PublicAPI] public bool? UseSSL { get; set; } - /// + /// + /// Gets or sets whether to start admin interface. + /// [PublicAPI] public bool? StartAdminInterface { get; set; } - /// + /// + /// Gets or sets if the static mappings should be read at startup. + /// [PublicAPI] public bool? ReadStaticMappings { get; set; } - /// + /// + /// Watch the static mapping files + folder for changes when running. + /// [PublicAPI] public bool? WatchStaticMappings { get; set; } - /// + /// + /// A value indicating whether subdirectories within the static mappings path should be monitored. + /// [PublicAPI] public bool? WatchStaticMappingsInSubdirectories { get; set; } - /// + /// + /// Gets or sets if the proxy and record settings. + /// [PublicAPI] - public IProxyAndRecordSettings ProxyAndRecordSettings { get; set; } + public ProxyAndRecordSettings ProxyAndRecordSettings { get; set; } - /// + /// + /// Gets or sets the urls. + /// [PublicAPI] public string[] Urls { get; set; } - /// + /// + /// StartTimeout + /// [PublicAPI] public int StartTimeout { get; set; } = 10000; - /// + /// + /// Allow Partial Mapping (default set to false). + /// [PublicAPI] public bool? AllowPartialMapping { get; set; } - /// + /// + /// The username needed for __admin access. + /// [PublicAPI] public string AdminUsername { get; set; } - /// + /// + /// The password needed for __admin access. + /// [PublicAPI] public string AdminPassword { get; set; } - /// + /// + /// The AzureAD Tenant needed for __admin access. + /// [PublicAPI] public string AdminAzureADTenant { get; set; } - /// + /// + /// The AzureAD Audience / Resource for __admin access. + /// [PublicAPI] public string AdminAzureADAudience { get; set; } - /// + /// + /// The RequestLog expiration in hours (optional). + /// [PublicAPI] public int? RequestLogExpirationDuration { get; set; } - /// + /// + /// The MaxRequestLog count (optional). + /// [PublicAPI] public int? MaxRequestLogCount { get; set; } - /// + /// + /// Action which is called (with the IAppBuilder or IApplicationBuilder) before the internal WireMockMiddleware is initialized. [Optional] + /// [PublicAPI] [JsonIgnore] public Action PreWireMockMiddlewareInit { get; set; } - /// + /// + /// Action which is called (with the IAppBuilder or IApplicationBuilder) after the internal WireMockMiddleware is initialized. [Optional] + /// [PublicAPI] [JsonIgnore] public Action PostWireMockMiddlewareInit { get; set; } #if USE_ASPNETCORE - /// + /// + /// Action which is called with IServiceCollection when ASP.NET Core DI is being configured. [Optional] + /// [PublicAPI] [JsonIgnore] public Action AdditionalServiceRegistration { get; set; } - /// + /// + /// Policies to use when using CORS. By default CORS is disabled. [Optional] + /// [PublicAPI] public CorsPolicyOptions? CorsPolicyOptions { get; set; } #endif - /// + /// + /// The IWireMockLogger which logs Debug, Info, Warning or Error + /// [PublicAPI] [JsonIgnore] public IWireMockLogger Logger { get; set; } - /// + /// + /// Handler to interact with the file system to read and write static mapping files. + /// [PublicAPI] [JsonIgnore] public IFileSystemHandler FileSystemHandler { get; set; } - /// + /// + /// Action which can be used to add additional Handlebars registrations. [Optional] + /// [PublicAPI] [JsonIgnore] public Action HandlebarsRegistrationCallback { get; set; } - /// + /// + /// Allow the usage of CSharpCodeMatcher (default is not allowed). + /// [PublicAPI] public bool? AllowCSharpCodeMatcher { get; set; } - /// + /// + /// Allow a Body for all HTTP Methods. (default set to false). + /// [PublicAPI] public bool? AllowBodyForAllHttpMethods { get; set; } - /// + /// + /// Allow only a HttpStatus Code in the response which is defined. (default set to false). + /// - false : also null, 0, empty or invalid HttpStatus codes are allowed. + /// - true : only codes defined in are allowed. + /// [PublicAPI] public bool? AllowOnlyDefinedHttpStatusCodeInResponse { get; set; } - /// + /// + /// Set to true to disable Json deserialization when processing requests. (default set to false). + /// [PublicAPI] public bool? DisableJsonBodyParsing { get; set; } - /// + /// + /// Disable support for GZip and Deflate request body decompression. (default set to false). + /// [PublicAPI] public bool? DisableRequestBodyDecompressing { get; set; } - /// + /// + /// Handle all requests synchronously. (default set to false). + /// [PublicAPI] public bool? HandleRequestsSynchronously { get; set; } - /// + /// + /// Throw an exception when the fails because of invalid input. (default set to false). + /// [PublicAPI] public bool? ThrowExceptionWhenMatcherFails { get; set; } - /// + /// + /// If https is used, these settings can be used to configure the CertificateSettings in case a custom certificate instead the default .NET certificate should be used. + /// + /// X509StoreName and X509StoreLocation should be defined + /// OR + /// X509CertificateFilePath and X509CertificatePassword should be defined + /// [PublicAPI] - public IWireMockCertificateSettings CertificateSettings { get; set; } + public WireMockCertificateSettings CertificateSettings { get; set; } - /// + /// + /// Defines if custom CertificateSettings are defined + /// [PublicAPI] public bool CustomCertificateDefined => CertificateSettings?.IsDefined == true; - /// + /// + /// Defines the global IWebhookSettings to use. + /// [PublicAPI] - public IWebhookSettings WebhookSettings { get; set; } + public WebhookSettings WebhookSettings { get; set; } - /// + /// + /// Use the instead of the default (default set to true). + /// [PublicAPI] public bool? UseRegexExtended { get; set; } = true; - /// + /// + /// Save unmatched requests to a file using the (default set to false). + /// [PublicAPI] public bool? SaveUnmatchedRequests { get; set; } - /// + /// + /// Custom matcher mappings for static mappings + /// [PublicAPI, JsonIgnore] public IDictionary> CustomMatcherMappings { get; set; } } diff --git a/src/WireMock.Net/Settings/WireMockServerSettingsParser.cs b/src/WireMock.Net/Settings/WireMockServerSettingsParser.cs index d331144d6..8c8539cbf 100644 --- a/src/WireMock.Net/Settings/WireMockServerSettingsParser.cs +++ b/src/WireMock.Net/Settings/WireMockServerSettingsParser.cs @@ -8,7 +8,7 @@ namespace WireMock.Settings { /// - /// A static helper class to parse commandline arguments into IWireMockServerSettings. + /// A static helper class to parse commandline arguments into WireMockServerSettings. /// public static class WireMockServerSettingsParser { @@ -19,7 +19,7 @@ public static class WireMockServerSettingsParser /// The logger (optional, can be null) /// The parsed settings [PublicAPI] - public static bool TryParseArguments([NotNull] string[] args, out IWireMockServerSettings settings, [CanBeNull] IWireMockLogger logger = null) + public static bool TryParseArguments([NotNull] string[] args, out WireMockServerSettings settings, [CanBeNull] IWireMockLogger logger = null) { Guard.HasNoNulls(args, nameof(args)); @@ -42,8 +42,8 @@ public static bool TryParseArguments([NotNull] string[] args, out IWireMockServe WatchStaticMappingsInSubdirectories = parser.GetBoolValue("WatchStaticMappingsInSubdirectories"), AdminUsername = parser.GetStringValue("AdminUsername"), AdminPassword = parser.GetStringValue("AdminPassword"), - AdminAzureADTenant = parser.GetStringValue(nameof(IWireMockServerSettings.AdminAzureADTenant)), - AdminAzureADAudience = parser.GetStringValue(nameof(IWireMockServerSettings.AdminAzureADAudience)), + AdminAzureADTenant = parser.GetStringValue(nameof(WireMockServerSettings.AdminAzureADTenant)), + AdminAzureADAudience = parser.GetStringValue(nameof(WireMockServerSettings.AdminAzureADAudience)), MaxRequestLogCount = parser.GetIntValue("MaxRequestLogCount"), RequestLogExpirationDuration = parser.GetIntValue("RequestLogExpirationDuration"), AllowCSharpCodeMatcher = parser.GetBoolValue("AllowCSharpCodeMatcher"), @@ -52,13 +52,13 @@ public static bool TryParseArguments([NotNull] string[] args, out IWireMockServe DisableJsonBodyParsing = parser.GetBoolValue("DisableJsonBodyParsing"), HandleRequestsSynchronously = parser.GetBoolValue("HandleRequestsSynchronously"), ThrowExceptionWhenMatcherFails = parser.GetBoolValue("ThrowExceptionWhenMatcherFails"), - UseRegexExtended = parser.GetBoolValue(nameof(IWireMockServerSettings.UseRegexExtended), true), - SaveUnmatchedRequests = parser.GetBoolValue(nameof(IWireMockServerSettings.SaveUnmatchedRequests)), + UseRegexExtended = parser.GetBoolValue(nameof(WireMockServerSettings.UseRegexExtended), true), + SaveUnmatchedRequests = parser.GetBoolValue(nameof(WireMockServerSettings.SaveUnmatchedRequests)), }; #if USE_ASPNETCORE settings.CorsPolicyOptions = parser.GetValue( - nameof(IWireMockServerSettings.CorsPolicyOptions), values => + nameof(WireMockServerSettings.CorsPolicyOptions), values => { var value = string.Join(string.Empty, values); return Enum.TryParse(value, true, out var corsPolicyOptions) ? corsPolicyOptions : CorsPolicyOptions.None; diff --git a/test/WireMock.Net.Tests/ResponseBuilders/ResponseWithStatusCodeTests.cs b/test/WireMock.Net.Tests/ResponseBuilders/ResponseWithStatusCodeTests.cs index 49cd36bea..7707a44f6 100644 --- a/test/WireMock.Net.Tests/ResponseBuilders/ResponseWithStatusCodeTests.cs +++ b/test/WireMock.Net.Tests/ResponseBuilders/ResponseWithStatusCodeTests.cs @@ -11,7 +11,7 @@ namespace WireMock.Net.Tests.ResponseBuilders { public class ResponseWithStatusCodeTests { - private readonly Mock _settingsMock = new Mock(); + private readonly Mock _settingsMock = new Mock(); private const string ClientIp = "::1"; [Theory]