From 0a5c9880bd7ed5e6621658d6706013333463ba03 Mon Sep 17 00:00:00 2001 From: Stef Heyenrath Date: Fri, 16 Aug 2019 16:11:59 +0000 Subject: [PATCH] Remove coverlet folder (#320) --- .gitignore | 2 + ...Net.StandAlone_SimpleCommandLineParser.htm | 125 +- .../WireMock.Net.StandAlone_StandAloneApp.htm | 100 +- .../WireMock.Net_AspNetCoreSelfHost.htm | 169 +-- report/coverlet/WireMock.Net_BodyData.htm | 40 +- report/coverlet/WireMock.Net_BodyModel.htm | 23 +- report/coverlet/WireMock.Net_BodyParser.htm | 98 +- report/coverlet/WireMock.Net_Check.htm | 149 +- .../WireMock.Net_ClientCertificateHelper.htm | 52 +- .../coverlet/WireMock.Net_ClientIPModel.htm | 23 +- ...ck.Net_ConcurentObservableCollection_1.htm | 87 +- report/coverlet/WireMock.Net_CookieModel.htm | 30 +- report/coverlet/WireMock.Net_CoreStrings.htm | 51 +- .../WireMock.Net_DictionaryExtensions.htm | 43 +- ...eMock.Net_DynamicAsyncResponseProvider.htm | 34 +- .../WireMock.Net_DynamicResponseProvider.htm | 34 +- .../coverlet/WireMock.Net_EncodingModel.htm | 33 +- ...WireMock.Net_EnhancedFileSystemWatcher.htm | 264 +--- report/coverlet/WireMock.Net_ExactMatcher.htm | 64 +- .../WireMock.Net_ExactObjectMatcher.htm | 81 +- report/coverlet/WireMock.Net_FileHelper.htm | 44 +- .../WireMock.Net_FluentMockServer.htm | 1339 +---------------- .../WireMock.Net_FluentMockServerSettings.htm | 97 +- ...WireMock.Net_GlobalExceptionMiddleware.htm | 81 +- .../WireMock.Net_HandleBarsJsonPath.htm | 83 +- .../coverlet/WireMock.Net_HandleBarsLinq.htm | 96 +- .../coverlet/WireMock.Net_HandleBarsRegex.htm | 76 +- .../WireMock.Net_HandlebarsHelpers.htm | 24 +- report/coverlet/WireMock.Net_HeaderModel.htm | 30 +- .../WireMock.Net_HttpClientHelper.htm | 88 +- .../WireMock.Net_HttpRequestMessageHelper.htm | 96 +- report/coverlet/WireMock.Net_JsonMatcher.htm | 115 +- .../coverlet/WireMock.Net_JsonPathMatcher.htm | 112 +- report/coverlet/WireMock.Net_JsonUtils.htm | 157 +- report/coverlet/WireMock.Net_LinqMatcher.htm | 117 +- .../WireMock.Net_LocalFileSystemHandler.htm | 72 +- report/coverlet/WireMock.Net_LogEntry.htm | 69 +- .../coverlet/WireMock.Net_LogEntryMapper.htm | 82 +- .../coverlet/WireMock.Net_LogEntryModel.htm | 50 +- .../WireMock.Net_LogRequestMatchModel.htm | 60 +- .../coverlet/WireMock.Net_LogRequestModel.htm | 93 +- .../WireMock.Net_LogResponseModel.htm | 72 +- report/coverlet/WireMock.Net_Mapping.htm | 115 +- .../WireMock.Net_MappingConverter.htm | 152 +- .../coverlet/WireMock.Net_MappingMatcher.htm | 58 +- report/coverlet/WireMock.Net_MappingModel.htm | 61 +- .../WireMock.Net_MatchBehaviourHelper.htm | 37 +- report/coverlet/WireMock.Net_MatchScores.htm | 71 +- .../coverlet/WireMock.Net_MatcherMapper.htm | 106 +- report/coverlet/WireMock.Net_MatcherModel.htm | 43 +- .../WireMock.Net_OwinRequestMapper.htm | 99 +- .../WireMock.Net_OwinResponseMapper.htm | 110 +- report/coverlet/WireMock.Net_ParamModel.htm | 28 +- report/coverlet/WireMock.Net_PathModel.htm | 23 +- report/coverlet/WireMock.Net_PortUtils.htm | 65 +- .../WireMock.Net_ProxyAndRecordSettings.htm | 40 +- ...ireMock.Net_ProxyAsyncResponseProvider.htm | 38 +- .../WireMock.Net_PublicCertificateHelper.htm | 101 +- report/coverlet/WireMock.Net_RegexMatcher.htm | 114 +- report/coverlet/WireMock.Net_RegexUtils.htm | 34 +- report/coverlet/WireMock.Net_Request.htm | 428 +----- .../WireMock.Net_RequestMatchResult.htm | 92 +- .../coverlet/WireMock.Net_RequestMessage.htm | 222 +-- ...WireMock.Net_RequestMessageBodyMatcher.htm | 168 +-- ...Mock.Net_RequestMessageClientIPMatcher.htm | 85 +- ...ock.Net_RequestMessageCompositeMatcher.htm | 62 +- ...reMock.Net_RequestMessageCookieMatcher.htm | 121 +- ...reMock.Net_RequestMessageHeaderMatcher.htm | 141 +- ...reMock.Net_RequestMessageMethodMatcher.htm | 55 +- ...ireMock.Net_RequestMessageParamMatcher.htm | 130 +- ...WireMock.Net_RequestMessagePathMatcher.htm | 87 +- ..._RequestMessageScenarioAndStateMatcher.htm | 56 +- .../WireMock.Net_RequestMessageUrlMatcher.htm | 85 +- report/coverlet/WireMock.Net_RequestModel.htm | 60 +- .../WireMock.Net_RespondWithAProvider.htm | 125 +- report/coverlet/WireMock.Net_Response.htm | 424 +----- .../coverlet/WireMock.Net_ResponseMessage.htm | 105 +- .../WireMock.Net_ResponseMessageBuilder.htm | 36 +- ...ireMock.Net_ResponseMessageTransformer.htm | 145 +- .../coverlet/WireMock.Net_ResponseModel.htm | 100 +- .../coverlet/WireMock.Net_ScenarioState.htm | 38 +- .../WireMock.Net_ScenarioStateModel.htm | 38 +- .../coverlet/WireMock.Net_SettingsModel.htm | 38 +- .../WireMock.Net_SimMetricsMatcher.htm | 135 +- report/coverlet/WireMock.Net_StatusModel.htm | 30 +- report/coverlet/WireMock.Net_UrlDetails.htm | 61 +- report/coverlet/WireMock.Net_UrlModel.htm | 23 +- report/coverlet/WireMock.Net_UrlUtils.htm | 48 +- .../coverlet/WireMock.Net_WildcardMatcher.htm | 73 +- .../WireMock.Net_WireMockConsoleLogger.htm | 69 +- .../coverlet/WireMock.Net_WireMockList_1.htm | 54 +- .../WireMock.Net_WireMockMiddleware.htm | 198 +-- ...WireMock.Net_WireMockMiddlewareOptions.htm | 49 +- .../WireMock.Net_WireMockNullLogger.htm | 51 +- report/coverlet/WireMock.Net_XPathMatcher.htm | 87 +- report/coverlet/combined.js | 188 +-- report/coverlet/index.htm | 198 +-- report/run-codecov-local.cmd | 10 - 98 files changed, 479 insertions(+), 9486 deletions(-) delete mode 100644 report/run-codecov-local.cmd diff --git a/.gitignore b/.gitignore index f1e3d20e..b018970d 100644 --- a/.gitignore +++ b/.gitignore @@ -250,3 +250,5 @@ paket-files/ # JetBrains Rider .idea/ *.sln.iml + +./report/coverlet/ diff --git a/report/coverlet/WireMock.Net.StandAlone_SimpleCommandLineParser.htm b/report/coverlet/WireMock.Net.StandAlone_SimpleCommandLineParser.htm index 82d16e7d..5b318112 100644 --- a/report/coverlet/WireMock.Net.StandAlone_SimpleCommandLineParser.htm +++ b/report/coverlet/WireMock.Net.StandAlone_SimpleCommandLineParser.htm @@ -20,7 +20,7 @@ Covered lines:66 Uncovered lines:6 Coverable lines:72 -Total lines:115 +Total lines:0 Line coverage:91.6% Branch coverage:85% @@ -40,127 +40,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net.StandAlone\SimpleCommandLineParser.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using System.Linq;
 4
 5namespace WireMock.Net.StandAlone
 6{
 7    // Based on http://blog.gauffin.org/2014/12/simple-command-line-parser/
 8    internal class SimpleCommandLineParser
 9    {
 10        private const string Sigil = "--";
 11        private const string SigilAzureServiceFabric = "'--";
 12
 13        private enum SigilType
 14        {
 15            Normal,
 16            AzureServiceFabric
 17        }
 18
 4719        private IDictionary<string, string[]> Arguments { get; } = new Dictionary<string, string[]>();
 20
 21        public void Parse(string[] args)
 522        {
 523            SigilType sigil = SigilType.Normal;
 524            string currentName = null;
 25
 526            var values = new List<string>();
 6727            foreach (string arg in args)
 2628            {
 2629                if (arg.StartsWith(Sigil))
 730                {
 731                    sigil = SigilType.Normal;
 32
 733                    if (!string.IsNullOrEmpty(currentName))
 634                    {
 635                        Arguments[currentName] = values.ToArray();
 636                    }
 37
 738                    values.Clear();
 739                    currentName = arg.Substring(Sigil.Length);
 740                }
 41                // Azure Service Fabric passes the command line parameter surrounded with single quotes. (https://github
 1942                else if (arg.StartsWith(SigilAzureServiceFabric))
 643                {
 644                    sigil = SigilType.AzureServiceFabric;
 45
 646                    if (!string.IsNullOrEmpty(currentName))
 247                    {
 248                        Arguments[currentName] = values.ToArray();
 249                    }
 50
 651                    values.Clear();
 652                    currentName = arg.Substring(SigilAzureServiceFabric.Length);
 653                }
 1354                else if (string.IsNullOrEmpty(currentName))
 055                {
 056                    Arguments[arg] = new string[0];
 057                }
 58                else
 1359                {
 1360                    if (sigil == SigilType.Normal)
 761                    {
 762                        values.Add(arg);
 763                    }
 64                    else
 665                    {
 666                        values.Add(arg.Substring(0, arg.Length - 1));
 667                    }
 1368                }
 2669            }
 70
 571            if (!string.IsNullOrEmpty(currentName))
 572            {
 573                Arguments[currentName] = values.ToArray();
 574            }
 575        }
 76
 77        public bool Contains(string name)
 1678        {
 1679            return Arguments.ContainsKey(name);
 1680        }
 81
 82        public string[] GetValues(string name, string[] defaultValue = null)
 083        {
 084            return Contains(name) ? Arguments[name] : defaultValue;
 085        }
 86
 87        public T GetValue<T>(string name, Func<string[], T> func, T defaultValue = default(T))
 1688        {
 1689            return Contains(name) ? func(Arguments[name]) : defaultValue;
 1690        }
 91
 92        public bool GetBoolValue(string name, bool defaultValue = false)
 393        {
 394            return GetValue(name, values =>
 595            {
 596                string value = values.FirstOrDefault();
 597                return !string.IsNullOrEmpty(value) ? bool.Parse(value) : defaultValue;
 598            }, defaultValue);
 399        }
 100
 101        public int? GetIntValue(string name, int? defaultValue = null)
 4102        {
 4103            return GetValue(name, values =>
 6104            {
 6105                string value = values.FirstOrDefault();
 6106                return !string.IsNullOrEmpty(value) ? int.Parse(value) : defaultValue;
 6107            }, defaultValue);
 4108        }
 109
 110        public string GetStringValue(string name, string defaultValue = null)
 9111        {
 18112            return GetValue(name, values => values.FirstOrDefault() ?? defaultValue, defaultValue);
 9113        }
 114    }
 115}
- +

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net.StandAlone\SimpleCommandLineParser.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net.StandAlone_StandAloneApp.htm b/report/coverlet/WireMock.Net.StandAlone_StandAloneApp.htm index e030df8a..d6f2ab39 100644 --- a/report/coverlet/WireMock.Net.StandAlone_StandAloneApp.htm +++ b/report/coverlet/WireMock.Net.StandAlone_StandAloneApp.htm @@ -20,7 +20,7 @@ Covered lines:0 Uncovered lines:48 Coverable lines:48 -Total lines:90 +Total lines:0 Line coverage:0% Branch coverage:0% @@ -35,102 +35,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net.StandAlone\StandAloneApp.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System.Linq;
 2using WireMock.Server;
 3using WireMock.Settings;
 4using WireMock.Validation;
 5using JetBrains.Annotations;
 6using WireMock.Logging;
 7
 8namespace WireMock.Net.StandAlone
 9{
 10    /// <summary>
 11    /// The StandAloneApp
 12    /// </summary>
 13    public static class StandAloneApp
 14    {
 15        /// <summary>
 16        /// Start WireMock.Net standalone Server based on the FluentMockServerSettings.
 17        /// </summary>
 18        /// <param name="settings">The FluentMockServerSettings</param>
 19        [PublicAPI]
 20        public static FluentMockServer Start([NotNull] IFluentMockServerSettings settings)
 021        {
 022            Check.NotNull(settings, nameof(settings));
 23
 024            var server = FluentMockServer.Start(settings);
 25
 026            settings.Logger.Info("WireMock.Net server listening at {0}", string.Join(",", server.Urls));
 27
 028            return server;
 029        }
 30
 31        /// <summary>
 32        /// Start WireMock.Net standalone Server based on the commandline arguments.
 33        /// </summary>
 34        /// <param name="args">The commandline arguments</param>
 35        /// <param name="logger">The logger</param>
 36        [PublicAPI]
 37        public static FluentMockServer Start([NotNull] string[] args, [CanBeNull] IWireMockLogger logger = null)
 038        {
 039            Check.NotNull(args, nameof(args));
 40
 041            var parser = new SimpleCommandLineParser();
 042            parser.Parse(args);
 43
 044            var settings = new FluentMockServerSettings
 045            {
 046                StartAdminInterface = parser.GetBoolValue("StartAdminInterface", true),
 047                ReadStaticMappings = parser.GetBoolValue("ReadStaticMappings"),
 048                WatchStaticMappings = parser.GetBoolValue("WatchStaticMappings"),
 049                AllowPartialMapping = parser.GetBoolValue("AllowPartialMapping", false),
 050                AdminUsername = parser.GetStringValue("AdminUsername"),
 051                AdminPassword = parser.GetStringValue("AdminPassword"),
 052                MaxRequestLogCount = parser.GetIntValue("MaxRequestLogCount"),
 053                RequestLogExpirationDuration = parser.GetIntValue("RequestLogExpirationDuration"),
 054            };
 55
 056            if (logger != null)
 057            {
 058                settings.Logger = logger;
 059            }
 60
 061            if (parser.Contains("Port"))
 062            {
 063                settings.Port = parser.GetIntValue("Port");
 064            }
 65            else
 066            {
 067                settings.Urls = parser.GetValues("Urls", new[] { "http://*:9091/" });
 068            }
 69
 070            string proxyURL = parser.GetStringValue("ProxyURL");
 071            if (!string.IsNullOrEmpty(proxyURL))
 072            {
 073                settings.ProxyAndRecordSettings = new ProxyAndRecordSettings
 074                {
 075                    Url = proxyURL,
 076                    SaveMapping = parser.GetBoolValue("SaveMapping"),
 077                    SaveMappingToFile = parser.GetBoolValue("SaveMappingToFile"),
 078                    ClientX509Certificate2ThumbprintOrSubjectName = parser.GetStringValue("ClientX509Certificate2Thumbpr
 079                    BlackListedHeaders = parser.GetValues("BlackListedHeaders")
 080                };
 081            }
 82
 083            settings.Logger.Debug("WireMock.Net server arguments [{0}]", string.Join(", ", args.Select(a => $"'{a}'")));
 84
 085            FluentMockServer server = Start(settings);
 86
 087            return server;
 088        }
 89    }
 90}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net.StandAlone\StandAloneApp.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_AspNetCoreSelfHost.htm b/report/coverlet/WireMock.Net_AspNetCoreSelfHost.htm index 8b6bf530..30f3eca3 100644 --- a/report/coverlet/WireMock.Net_AspNetCoreSelfHost.htm +++ b/report/coverlet/WireMock.Net_AspNetCoreSelfHost.htm @@ -20,7 +20,7 @@ Covered lines:83 Uncovered lines:7 Coverable lines:90 -Total lines:159 +Total lines:0 Line coverage:92.2% Branch coverage:75% @@ -37,171 +37,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Owin\AspNetCoreSelfHost.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1#if USE_ASPNETCORE
 2using System;
 3using System.Collections.Generic;
 4using System.Linq;
 5using System.Threading;
 6using System.Threading.Tasks;
 7using JetBrains.Annotations;
 8using Microsoft.AspNetCore.Builder;
 9using Microsoft.AspNetCore.Hosting;
 10using Microsoft.Extensions.DependencyInjection;
 11using WireMock.HttpsCertificate;
 12using WireMock.Logging;
 13using WireMock.Owin.Mappers;
 14using WireMock.Util;
 15using WireMock.Validation;
 16
 17namespace WireMock.Owin
 18{
 19    internal class AspNetCoreSelfHost : IOwinSelfHost
 20    {
 4721        private readonly CancellationTokenSource _cts = new CancellationTokenSource();
 22        private readonly IWireMockMiddlewareOptions _options;
 23        private readonly string[] _urls;
 24        private readonly IWireMockLogger _logger;
 25        private Exception _runningException;
 26
 27        private IWebHost _host;
 28
 9629        public bool IsStarted { get; private set; }
 30
 9431        public List<string> Urls { get; } = new List<string>();
 32
 14133        public List<int> Ports { get; } = new List<int>();
 34
 035        public Exception RunningException => _runningException;
 36
 4737        public AspNetCoreSelfHost([NotNull] IWireMockMiddlewareOptions options, [NotNull] params string[] uriPrefixes)
 4738        {
 4739            Check.NotNull(options, nameof(options));
 4740            Check.NotNullOrEmpty(uriPrefixes, nameof(uriPrefixes));
 41
 4742            _logger = options.Logger ?? new WireMockConsoleLogger();
 43
 23544            foreach (string uriPrefix in uriPrefixes)
 4745            {
 4746                Urls.Add(uriPrefix);
 47
 4748                PortUtils.TryExtract(uriPrefix, out string protocol, out string host, out int port);
 4749                Ports.Add(port);
 4750            }
 51
 4752            _options = options;
 4753            _urls = uriPrefixes;
 4754        }
 55
 56        public Task StartAsync()
 4757        {
 4758            _host = new WebHostBuilder()
 4759                .ConfigureServices(services =>
 9460                {
 9461                    services.AddSingleton<IWireMockMiddlewareOptions>(_options);
 9462                    services.AddSingleton<IMappingMatcher, MappingMatcher>();
 9463                    services.AddSingleton<IOwinRequestMapper, OwinRequestMapper>();
 9464                    services.AddSingleton<IOwinResponseMapper, OwinResponseMapper>();
 9465                })
 4766                .Configure(appBuilder =>
 9467                {
 9468                    appBuilder.UseMiddleware<GlobalExceptionMiddleware>();
 4769
 9470                    _options.PreWireMockMiddlewareInit?.Invoke(appBuilder);
 4771
 9472                    appBuilder.UseMiddleware<WireMockMiddleware>();
 4773
 9474                    _options.PostWireMockMiddlewareInit?.Invoke(appBuilder);
 9475                })
 4776                .UseKestrel(options =>
 9477                {
 4778#if NETSTANDARD1_3
 4779                    if (_urls.Any(u => u.StartsWith("https://", StringComparison.OrdinalIgnoreCase)))
 4780                    {
 4781                        options.UseHttps(PublicCertificateHelper.GetX509Certificate2());
 4782                    }
 4783#else
 4784                    // https://docs.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel?tabs=aspnetcore2x
 32985                    foreach (string url in _urls.Where(u => u.StartsWith("http://", StringComparison.OrdinalIgnoreCase))
 9486                    {
 9487                        PortUtils.TryExtract(url, out string protocol, out string host, out int port);
 9488                        options.Listen(System.Net.IPAddress.Any, port);
 9489                    }
 4790
 23591                    foreach (string url in _urls.Where(u => u.StartsWith("https://", StringComparison.OrdinalIgnoreCase)
 4792                    {
 4793                        PortUtils.TryExtract(url, out string protocol, out string host, out int port);
 4794                        options.Listen(System.Net.IPAddress.Any, port, listenOptions =>
 4795                        {
 4796                            listenOptions.UseHttps(PublicCertificateHelper.GetX509Certificate2());
 4797                        });
 4798                    }
 4799#endif
 94100                })
 47101#if NETSTANDARD1_3
 47102                .UseUrls(_urls)
 47103#endif
 47104                .Build();
 105
 47106            return RunHost(_cts.Token);
 47107        }
 108
 109        private Task RunHost(CancellationToken token)
 47110        {
 111            try
 47112            {
 47113                var appLifetime = (IApplicationLifetime)_host.Services.GetService(typeof(IApplicationLifetime));
 47114                appLifetime.ApplicationStarted.Register(() =>
 94115                {
 94116                    IsStarted = true;
 94117                });
 118
 119#if NETSTANDARD1_3
 120                _logger.Info("WireMock.Net server using netstandard1.3");
 121#elif NETSTANDARD2_0
 47122                _logger.Info("WireMock.Net server using netstandard2.0");
 123#elif NET46
 124                _logger.Info("WireMock.Net server using .net 4.6.1 or higher");
 125#endif
 126#if NETSTANDARD1_3
 127                return Task.Run(() =>
 128                {
 129                    _host.Run(token);
 130                });
 131#else
 47132                return _host.RunAsync(token);
 133#endif
 134            }
 0135            catch (Exception e)
 0136            {
 0137                _runningException = e;
 0138                _logger.Error(e.ToString());
 139
 0140                IsStarted = false;
 141
 0142                return Task.CompletedTask;
 143            }
 47144        }
 145
 146        public Task StopAsync()
 2147        {
 2148            _cts.Cancel();
 149
 2150            IsStarted = false;
 151#if NETSTANDARD1_3
 152            return Task.FromResult(true);
 153#else
 2154            return _host.StopAsync();
 155#endif
 2156        }
 157    }
 158}
 159#endif
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Owin\AspNetCoreSelfHost.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_BodyData.htm b/report/coverlet/WireMock.Net_BodyData.htm index ad2d6bcb..316ee052 100644 --- a/report/coverlet/WireMock.Net_BodyData.htm +++ b/report/coverlet/WireMock.Net_BodyData.htm @@ -20,48 +20,14 @@ Covered lines:4 Uncovered lines:0 Coverable lines:4 -Total lines:30 +Total lines:0 Line coverage:100%

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Util\BodyData.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System.Text;
 2
 3namespace WireMock.Util
 4{
 5    /// <summary>
 6    /// BodyData
 7    /// </summary>
 8    public class BodyData
 9    {
 10        /// <summary>
 11        /// The body encoding.
 12        /// </summary>
 9313        public Encoding Encoding { get; set; }
 14
 15        /// <summary>
 16        /// The body as string, this is defined when BodyAsString or BodyAsJson are not null.
 17        /// </summary>
 13518        public string BodyAsString { get; set; }
 19
 20        /// <summary>
 21        /// The body (as JSON object).
 22        /// </summary>
 11023        public object BodyAsJson { get; set; }
 24
 25        /// <summary>
 26        /// The body (as bytearray).
 27        /// </summary>
 8628        public byte[] BodyAsBytes { get; set; }
 29    }
 30}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Util\BodyData.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_BodyModel.htm b/report/coverlet/WireMock.Net_BodyModel.htm index 8e012c90..aa0b2de3 100644 --- a/report/coverlet/WireMock.Net_BodyModel.htm +++ b/report/coverlet/WireMock.Net_BodyModel.htm @@ -20,31 +20,14 @@ Covered lines:1 Uncovered lines:0 Coverable lines:1 -Total lines:13 +Total lines:0 Line coverage:100%

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Admin\Mappings\BodyModel.cs

- - - - - - - - - - - - - - - - - -
#LineLine coverage
 1namespace WireMock.Admin.Mappings
 2{
 3    /// <summary>
 4    /// Body Model
 5    /// </summary>
 6    public class BodyModel
 7    {
 8        /// <summary>
 9        /// Gets or sets the matcher.
 10        /// </summary>
 1811        public MatcherModel Matcher { get; set; }
 12    }
 13}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Admin\Mappings\BodyModel.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_BodyParser.htm b/report/coverlet/WireMock.Net_BodyParser.htm index b68c847a..038fa1c2 100644 --- a/report/coverlet/WireMock.Net_BodyParser.htm +++ b/report/coverlet/WireMock.Net_BodyParser.htm @@ -20,7 +20,7 @@ Covered lines:39 Uncovered lines:17 Coverable lines:56 -Total lines:88 +Total lines:0 Line coverage:69.6% Branch coverage:39.2% @@ -37,100 +37,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Util\BodyParser.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using System.IO;
 3using System.Linq;
 4using System.Text;
 5using System.Threading.Tasks;
 6using JetBrains.Annotations;
 7using Newtonsoft.Json;
 8
 9namespace WireMock.Util
 10{
 11    internal static class BodyParser
 12    {
 113        private static readonly string[] JsonContentTypes =
 114        {
 115            "application/json",
 116            "application/vnd.api+json"
 117        };
 18
 119        private static readonly string[] TextContentTypes =
 120        {
 121            "text/",
 122            "application/javascript", "application/typescript",
 123            "application/xml", "application/xhtml+xml",
 124            "application/x-www-form-urlencoded"
 125        };
 26
 27        private static async Task<Tuple<string, Encoding>> ReadStringAsync(Stream stream)
 1028        {
 1029            using (var streamReader = new StreamReader(stream))
 1030            {
 1031                string content = await streamReader.ReadToEndAsync();
 32
 1033                return new Tuple<string, Encoding>(content, streamReader.CurrentEncoding);
 34            }
 1035        }
 36
 37        private static async Task<byte[]> ReadBytesAsync(Stream stream)
 038        {
 039            using (var memoryStream = new MemoryStream())
 040            {
 041                await stream.CopyToAsync(memoryStream);
 042                return memoryStream.ToArray();
 43            }
 044        }
 45
 46        public static async Task<BodyData> Parse([NotNull] Stream stream, [CanBeNull] string contentTypeHeaderValue)
 1047        {
 1048            var data = new BodyData();
 49
 6350            if (contentTypeHeaderValue != null && TextContentTypes.Any(text => contentTypeHeaderValue.StartsWith(text, S
 251            {
 52                try
 253                {
 254                    var stringData = await ReadStringAsync(stream);
 255                    data.BodyAsString = stringData.Item1;
 256                    data.Encoding = stringData.Item2;
 257                }
 058                catch
 059                {
 60                    // Reading as string failed, just get the ByteArray.
 061                    data.BodyAsBytes = await ReadBytesAsync(stream);
 062                }
 263            }
 1864            else if (contentTypeHeaderValue != null && JsonContentTypes.Any(json => contentTypeHeaderValue.StartsWith(js
 865            {
 866                var stringData = await ReadStringAsync(stream);
 867                data.BodyAsString = stringData.Item1;
 868                data.Encoding = stringData.Item2;
 69
 70                try
 871                {
 872                    data.BodyAsJson = JsonConvert.DeserializeObject(stringData.Item1, new JsonSerializerSettings { Forma
 873                }
 074                catch
 075                {
 76                    // JsonConvert failed, just set the Body as string.
 077                    data.BodyAsString = stringData.Item1;
 078                }
 879            }
 80            else
 081            {
 082                data.BodyAsBytes = await ReadBytesAsync(stream);
 083            }
 84
 1085            return data;
 1086        }
 87    }
 88}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Util\BodyParser.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_Check.htm b/report/coverlet/WireMock.Net_Check.htm index c96c3ac4..76bda16a 100644 --- a/report/coverlet/WireMock.Net_Check.htm +++ b/report/coverlet/WireMock.Net_Check.htm @@ -20,7 +20,7 @@ Covered lines:39 Uncovered lines:32 Coverable lines:71 -Total lines:139 +Total lines:0 Line coverage:54.9% Branch coverage:54.1% @@ -41,151 +41,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Validation\Check.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1// Copyright (c) .NET Foundation. All rights reserved.
 2// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
 3
 4using System;
 5using System.Collections.Generic;
 6using System.Diagnostics;
 7using System.Linq;
 8using System.Reflection;
 9using JetBrains.Annotations;
 10
 11// Copied from https://github.com/aspnet/EntityFramework/blob/dev/src/Shared/Check.cs
 12namespace WireMock.Validation
 13{
 14    // [ExcludeFromCodeCoverage]
 15    [DebuggerStepThrough]
 16    internal static class Check
 17    {
 18        [ContractAnnotation("value:null => halt")]
 19        public static T Condition<T>([NoEnumeration] T value, [NotNull] Predicate<T> condition, [InvokerParameterName] [
 2420        {
 2421            NotNull(condition, nameof(condition));
 2422            NotNull(value, nameof(value));
 23
 2424            if (!condition(value))
 125            {
 126                NotNullOrEmpty(parameterName, nameof(parameterName));
 27
 128                throw new ArgumentOutOfRangeException(parameterName);
 29            }
 30
 2331            return value;
 2332        }
 33
 34        [ContractAnnotation("value:null => halt")]
 35        public static T NotNull<T>([NoEnumeration] T value, [InvokerParameterName] [NotNull] string parameterName)
 405236        {
 405337            if (ReferenceEquals(value, null))
 238            {
 239                NotNullOrEmpty(parameterName, nameof(parameterName));
 40
 241                throw new ArgumentNullException(parameterName);
 42            }
 43
 405044            return value;
 405145        }
 46
 47        [ContractAnnotation("value:null => halt")]
 48        public static T NotNull<T>([NoEnumeration] T value, [InvokerParameterName] [NotNull] string parameterName, [NotN
 049        {
 050            if (ReferenceEquals(value, null))
 051            {
 052                NotNullOrEmpty(parameterName, nameof(parameterName));
 053                NotNullOrEmpty(propertyName, nameof(propertyName));
 54
 055                throw new ArgumentException(CoreStrings.ArgumentPropertyNull(propertyName, parameterName));
 56            }
 57
 058            return value;
 059        }
 60
 61        [ContractAnnotation("value:null => halt")]
 62        public static IList<T> NotNullOrEmpty<T>(IList<T> value, [InvokerParameterName] [NotNull] string parameterName)
 45563        {
 45564            NotNull(value, parameterName);
 65
 45566            if (value.Count == 0)
 067            {
 068                NotNullOrEmpty(parameterName, nameof(parameterName));
 69
 070                throw new ArgumentException(CoreStrings.CollectionArgumentIsEmpty(parameterName));
 71            }
 72
 45673            return value;
 45674        }
 75
 76        [ContractAnnotation("value:null => halt")]
 77        public static string NotNullOrEmpty(string value, [InvokerParameterName] [NotNull] string parameterName)
 3678        {
 3679            Exception e = null;
 3680            if (ReferenceEquals(value, null))
 281            {
 282                e = new ArgumentNullException(parameterName);
 283            }
 3484            else if (value.Trim().Length == 0)
 085            {
 086                e = new ArgumentException(CoreStrings.ArgumentIsEmpty(parameterName));
 087            }
 88
 3689            if (e != null)
 290            {
 291                NotNullOrEmpty(parameterName, nameof(parameterName));
 92
 293                throw e;
 94            }
 95
 3496            return value;
 3497        }
 98
 99        public static string NullButNotEmpty(string value, [InvokerParameterName] [NotNull] string parameterName)
 0100        {
 0101            if (!ReferenceEquals(value, null)
 0102                && (value.Length == 0))
 0103            {
 0104                NotNullOrEmpty(parameterName, nameof(parameterName));
 105
 0106                throw new ArgumentException(CoreStrings.ArgumentIsEmpty(parameterName));
 107            }
 108
 0109            return value;
 0110        }
 111
 112        public static IList<T> HasNoNulls<T>(IList<T> value, [InvokerParameterName] [NotNull] string parameterName)
 113            where T : class
 39114        {
 39115            NotNull(value, parameterName);
 116
 78117            if (value.Any(e => e == null))
 0118            {
 0119                NotNullOrEmpty(parameterName, nameof(parameterName));
 120
 0121                throw new ArgumentException(parameterName);
 122            }
 123
 39124            return value;
 39125        }
 126
 127        public static Type ValidEntityType(Type value, [InvokerParameterName] [NotNull] string parameterName)
 0128        {
 0129            if (!value.GetTypeInfo().IsClass)
 0130            {
 0131                NotNullOrEmpty(parameterName, nameof(parameterName));
 132
 0133                throw new ArgumentException(CoreStrings.InvalidEntityType(value, parameterName));
 134            }
 135
 0136            return value;
 0137        }
 138    }
 139}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Validation\Check.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_ClientCertificateHelper.htm b/report/coverlet/WireMock.Net_ClientCertificateHelper.htm index d292889c..5246df47 100644 --- a/report/coverlet/WireMock.Net_ClientCertificateHelper.htm +++ b/report/coverlet/WireMock.Net_ClientCertificateHelper.htm @@ -20,7 +20,7 @@ Covered lines:0 Uncovered lines:17 Coverable lines:17 -Total lines:42 +Total lines:0 Line coverage:0% Branch coverage:0% @@ -34,54 +34,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\HttpsCertificate\ClientCertificateHelper.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System.IO;
 2using System.Security.Cryptography.X509Certificates;
 3
 4namespace WireMock.HttpsCertificate
 5{
 6    internal static class ClientCertificateHelper
 7    {
 8        public static X509Certificate2 GetCertificate(string thumbprintOrSubjectName)
 09        {
 010            X509Store certStore = new X509Store(StoreName.My, StoreLocation.LocalMachine);
 11            try
 012            {
 13                // Certificate must be in the local machine store
 014                certStore.Open(OpenFlags.ReadOnly);
 15
 16                // Attempt to find by thumbprint first
 017                var matchingCertificates = certStore.Certificates.Find(X509FindType.FindByThumbprint, thumbprintOrSubjec
 018                if (matchingCertificates.Count == 0)
 019                {
 20                    // Fallback to subject name
 021                    matchingCertificates = certStore.Certificates.Find(X509FindType.FindBySubjectName, thumbprintOrSubje
 022                    if (matchingCertificates.Count == 0)
 023                    {
 24                        // No certificates matched the search criteria.
 025                        throw new FileNotFoundException("No certificate found with specified Thumbprint or SubjectName."
 26                    }
 027                }
 28
 29                // Use the first matching certificate.
 030                return matchingCertificates[0];
 31            }
 32            finally
 033            {
 34#if NETSTANDARD || NET46
 035                certStore.Dispose();
 36#else
 37                certStore.Close();
 38#endif
 039            }
 040        }
 41    }
 42}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\HttpsCertificate\ClientCertificateHelper.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_ClientIPModel.htm b/report/coverlet/WireMock.Net_ClientIPModel.htm index d840f7db..36dd2f91 100644 --- a/report/coverlet/WireMock.Net_ClientIPModel.htm +++ b/report/coverlet/WireMock.Net_ClientIPModel.htm @@ -20,31 +20,14 @@ Covered lines:0 Uncovered lines:1 Coverable lines:1 -Total lines:13 +Total lines:0 Line coverage:0%

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Admin\Mappings\ClientIPModel.cs

- - - - - - - - - - - - - - - - - -
#LineLine coverage
 1namespace WireMock.Admin.Mappings
 2{
 3    /// <summary>
 4    /// ClientIPModel
 5    /// </summary>
 6    public class ClientIPModel
 7    {
 8        /// <summary>
 9        /// Gets or sets the matchers.
 10        /// </summary>
 011        public MatcherModel[] Matchers { get; set; }
 12    }
 13}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Admin\Mappings\ClientIPModel.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_ConcurentObservableCollection_1.htm b/report/coverlet/WireMock.Net_ConcurentObservableCollection_1.htm index 75734c57..e6f3c989 100644 --- a/report/coverlet/WireMock.Net_ConcurentObservableCollection_1.htm +++ b/report/coverlet/WireMock.Net_ConcurentObservableCollection_1.htm @@ -20,7 +20,7 @@ Covered lines:20 Uncovered lines:14 Coverable lines:34 -Total lines:77 +Total lines:0 Line coverage:58.8% @@ -40,89 +40,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Util\ConcurentObservableCollection.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System.Collections.Generic;
 2using System.Collections.ObjectModel;
 3
 4namespace WireMock.Util
 5{
 6    /// <summary>
 7    /// A special Collection that overrides methods of <see cref="ObservableCollection{T}"/> to make them thread safe
 8    /// </summary>
 9    /// <typeparam name="T">The type of elements in the collection.</typeparam>
 10    /// <inheritdoc cref="ObservableCollection{T}" />
 11    public class ConcurentObservableCollection<T> : ObservableCollection<T>
 12    {
 5413        private readonly object _lockObject = new object();
 14
 15        /// <summary>
 16        /// Initializes a new instance of the <see cref="T:WireMock.Util.ConcurentObservableCollection`1" /> class.
 17        /// </summary>
 16218        public ConcurentObservableCollection() { }
 19
 20        /// <summary>
 21        /// Initializes a new instance of the <see cref="ConcurentObservableCollection{T}"/> class that contains element
 22        /// </summary>
 23        /// <param name="list">The list from which the elements are copied.</param>
 024        public ConcurentObservableCollection(List<T> list) : base(list) { }
 25
 26        /// <summary>
 27        /// Initializes a new instance of the <see cref="ConcurentObservableCollection{T}"/> class that contains element
 28        /// </summary>
 29        /// <param name="collection">The collection from which the elements are copied.</param>
 030        public ConcurentObservableCollection(IEnumerable<T> collection) : base(collection) { }
 31
 32        /// <inheritdoc cref="ObservableCollection{T}.ClearItems"/>
 33        protected override void ClearItems()
 134        {
 135            lock (_lockObject)
 136            {
 137                base.ClearItems();
 138            }
 139        }
 40
 41        /// <inheritdoc cref="ObservableCollection{T}.RemoveItem"/>
 42        protected override void RemoveItem(int index)
 243        {
 244            lock (_lockObject)
 245            {
 246                base.RemoveItem(index);
 247            }
 248        }
 49
 50        /// <inheritdoc cref="ObservableCollection{T}.InsertItem"/>
 51        protected override void InsertItem(int index, T item)
 4052        {
 4053            lock (_lockObject)
 4054            {
 4055                base.InsertItem(index, item);
 4056            }
 4057        }
 58
 59        /// <inheritdoc cref="ObservableCollection{T}.SetItem"/>
 60        protected override void SetItem(int index, T item)
 061        {
 062            lock (_lockObject)
 063            {
 064                base.SetItem(index, item);
 065            }
 066        }
 67
 68        /// <inheritdoc cref="ObservableCollection{T}.MoveItem"/>
 69        protected override void MoveItem(int oldIndex, int newIndex)
 070        {
 071            lock (_lockObject)
 072            {
 073                base.MoveItem(oldIndex, newIndex);
 074            }
 075        }
 76    }
 77}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Util\ConcurentObservableCollection.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_CookieModel.htm b/report/coverlet/WireMock.Net_CookieModel.htm index 8aa842d4..19237c6c 100644 --- a/report/coverlet/WireMock.Net_CookieModel.htm +++ b/report/coverlet/WireMock.Net_CookieModel.htm @@ -20,38 +20,14 @@ Covered lines:0 Uncovered lines:2 Coverable lines:2 -Total lines:20 +Total lines:0 Line coverage:0%

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Admin\Mappings\CookieModel.cs

- - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System.Collections.Generic;
 2
 3namespace WireMock.Admin.Mappings
 4{
 5    /// <summary>
 6    /// Cookie Model
 7    /// </summary>
 8    public class CookieModel
 9    {
 10        /// <summary>
 11        /// Gets or sets the name.
 12        /// </summary>
 013        public string Name { get; set; }
 14
 15        /// <summary>
 16        /// Gets or sets the matchers.
 17        /// </summary>
 018        public IList<MatcherModel> Matchers { get; set; }
 19    }
 20}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Admin\Mappings\CookieModel.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_CoreStrings.htm b/report/coverlet/WireMock.Net_CoreStrings.htm index 0b74396c..20d5c477 100644 --- a/report/coverlet/WireMock.Net_CoreStrings.htm +++ b/report/coverlet/WireMock.Net_CoreStrings.htm @@ -20,7 +20,7 @@ Covered lines:0 Uncovered lines:12 Coverable lines:12 -Total lines:41 +Total lines:0 Line coverage:0% @@ -36,53 +36,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Validation\CoreStrings.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2
 3// copied from https://github.com/aspnet/EntityFramework/blob/dev/src/Microsoft.EntityFrameworkCore/Properties/CoreStrin
 4namespace WireMock.Validation
 5{
 6    // [ExcludeFromCodeCoverage]
 7    internal static class CoreStrings
 8    {
 9        /// <summary>
 10        /// The property '{property}' of the argument '{argument}' cannot be null.
 11        /// </summary>
 12        public static string ArgumentPropertyNull(string property, string argument)
 013        {
 014            return $"The property '{property}' of the argument '{argument}' cannot be null.";
 015        }
 16
 17        /// <summary>
 18        /// The string argument '{argumentName}' cannot be empty.
 19        /// </summary>
 20        public static string ArgumentIsEmpty(string argumentName)
 021        {
 022            return $"The string argument '{argumentName}' cannot be empty.";
 023        }
 24
 25        /// <summary>
 26        /// The entity type '{type}' provided for the argument '{argumentName}' must be a reference type.
 27        /// </summary>
 28        public static string InvalidEntityType(Type type, string argumentName)
 029        {
 030            return $"The entity type '{type}' provided for the argument '{argumentName}' must be a reference type.";
 031        }
 32
 33        /// <summary>
 34        /// The collection argument '{argumentName}' must contain at least one element.
 35        /// </summary>
 36        public static string CollectionArgumentIsEmpty(string argumentName)
 037        {
 038            return $"The collection argument '{argumentName}' must contain at least one element.";
 039        }
 40    }
 41}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Validation\CoreStrings.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_DictionaryExtensions.htm b/report/coverlet/WireMock.Net_DictionaryExtensions.htm index 4e0a32e5..88135223 100644 --- a/report/coverlet/WireMock.Net_DictionaryExtensions.htm +++ b/report/coverlet/WireMock.Net_DictionaryExtensions.htm @@ -20,7 +20,7 @@ Covered lines:0 Uncovered lines:10 Coverable lines:10 -Total lines:33 +Total lines:0 Line coverage:0% Branch coverage:0% @@ -34,45 +34,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Util\DictionaryExtensions.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using JetBrains.Annotations;
 4using WireMock.Validation;
 5
 6namespace WireMock.Util
 7{
 8    /// <summary>
 9    /// Some IDictionary Extensions
 10    /// </summary>
 11    public static class DictionaryExtensions
 12    {
 13        /// <summary>
 14        /// Loops the dictionary and executes the specified action.
 15        /// </summary>
 16        /// <typeparam name="TKey">The type of the key.</typeparam>
 17        /// <typeparam name="TValue">The type of the value.</typeparam>
 18        /// <param name="dictionary">The dictionary to loop (can be null).</param>
 19        /// <param name="action">The action.</param>
 20        public static void Loop<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, [NotNull] Action<TKey, TValue> 
 021        {
 022            Check.NotNull(action, nameof(action));
 23
 024            if (dictionary != null)
 025            {
 026                foreach (var entry in dictionary)
 027                {
 028                    action(entry.Key, entry.Value);
 029                }
 030            }
 031        }
 32    }
 33}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Util\DictionaryExtensions.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_DynamicAsyncResponseProvider.htm b/report/coverlet/WireMock.Net_DynamicAsyncResponseProvider.htm index 0d3336b5..4d805c91 100644 --- a/report/coverlet/WireMock.Net_DynamicAsyncResponseProvider.htm +++ b/report/coverlet/WireMock.Net_DynamicAsyncResponseProvider.htm @@ -20,7 +20,7 @@ Covered lines:0 Uncovered lines:8 Coverable lines:8 -Total lines:24 +Total lines:0 Line coverage:0% @@ -34,36 +34,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\ResponseProviders\DynamicAsyncResponseProvider.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using System.Threading.Tasks;
 3using JetBrains.Annotations;
 4using WireMock.Validation;
 5
 6namespace WireMock.ResponseProviders
 7{
 8    internal class DynamicAsyncResponseProvider : IResponseProvider
 9    {
 10        private readonly Func<RequestMessage, Task<ResponseMessage>> _responseMessageFunc;
 11
 012        public DynamicAsyncResponseProvider([NotNull] Func<RequestMessage, Task<ResponseMessage>> responseMessageFunc)
 013        {
 014            Check.NotNull(responseMessageFunc, nameof(responseMessageFunc));
 15
 016            _responseMessageFunc = responseMessageFunc;
 017        }
 18
 19        public Task<ResponseMessage> ProvideResponseAsync(RequestMessage requestMessage)
 020        {
 021            return _responseMessageFunc(requestMessage);
 022        }
 23    }
 24}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\ResponseProviders\DynamicAsyncResponseProvider.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_DynamicResponseProvider.htm b/report/coverlet/WireMock.Net_DynamicResponseProvider.htm index ddc2f59e..df23cd26 100644 --- a/report/coverlet/WireMock.Net_DynamicResponseProvider.htm +++ b/report/coverlet/WireMock.Net_DynamicResponseProvider.htm @@ -20,7 +20,7 @@ Covered lines:8 Uncovered lines:0 Coverable lines:8 -Total lines:24 +Total lines:0 Line coverage:100% @@ -34,36 +34,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\ResponseProviders\DynamicResponseProvider.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using System.Threading.Tasks;
 3using JetBrains.Annotations;
 4using WireMock.Validation;
 5
 6namespace WireMock.ResponseProviders
 7{
 8    internal class DynamicResponseProvider : IResponseProvider
 9    {
 10        private readonly Func<RequestMessage, ResponseMessage> _responseMessageFunc;
 11
 20912        public DynamicResponseProvider([NotNull] Func<RequestMessage, ResponseMessage> responseMessageFunc)
 20913        {
 20914            Check.NotNull(responseMessageFunc, nameof(responseMessageFunc));
 15
 20916            _responseMessageFunc = responseMessageFunc;
 20917        }
 18
 19        public Task<ResponseMessage> ProvideResponseAsync(RequestMessage requestMessage)
 820        {
 821            return Task.FromResult(_responseMessageFunc(requestMessage));
 822        }
 23    }
 24}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\ResponseProviders\DynamicResponseProvider.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_EncodingModel.htm b/report/coverlet/WireMock.Net_EncodingModel.htm index 5fd25f97..76c6f94a 100644 --- a/report/coverlet/WireMock.Net_EncodingModel.htm +++ b/report/coverlet/WireMock.Net_EncodingModel.htm @@ -20,41 +20,14 @@ Covered lines:3 Uncovered lines:0 Coverable lines:3 -Total lines:23 +Total lines:0 Line coverage:100%

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Admin\Mappings\EncodingModel.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1namespace WireMock.Admin.Mappings
 2{
 3    /// <summary>
 4    /// EncodingModel
 5    /// </summary>
 6    public class EncodingModel
 7    {
 8        /// <summary>
 9        /// Encoding CodePage
 10        /// </summary>
 8711        public int CodePage { get; set; }
 12
 13        /// <summary>
 14        /// Encoding EncodingName
 15        /// </summary>
 8116        public string EncodingName { get; set; }
 17
 18        /// <summary>
 19        /// Encoding WebName
 20        /// </summary>
 8121        public string WebName { get; set; }
 22    }
 23}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Admin\Mappings\EncodingModel.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_EnhancedFileSystemWatcher.htm b/report/coverlet/WireMock.Net_EnhancedFileSystemWatcher.htm index 993b6f05..316250ac 100644 --- a/report/coverlet/WireMock.Net_EnhancedFileSystemWatcher.htm +++ b/report/coverlet/WireMock.Net_EnhancedFileSystemWatcher.htm @@ -20,7 +20,7 @@ Covered lines:0 Uncovered lines:87 Coverable lines:87 -Total lines:254 +Total lines:0 Line coverage:0% Branch coverage:0% @@ -46,266 +46,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Util\EnhancedFileSystemWatcher.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using System.Collections.Concurrent;
 3using System.IO;
 4using JetBrains.Annotations;
 5using WireMock.Validation;
 6
 7namespace WireMock.Util
 8{
 9    /// <summary>
 10    /// An EnhancedFileSystemWatcher, which can be used to suppress duplicate events that fire on a single change to the
 11    /// </summary>
 12    /// <seealso cref="FileSystemWatcher" />
 13    public class EnhancedFileSystemWatcher : FileSystemWatcher
 14    {
 15        #region Private Members
 16        // Default Watch Interval in Milliseconds
 17        private const int DefaultWatchInterval = 100;
 18
 19        // This Dictionary keeps the track of when an event occured last for a particular file
 20        private ConcurrentDictionary<string, DateTime> _lastFileEvent;
 21
 22        // Watch Interval in Milliseconds
 23        private int _interval;
 24
 25        // Timespan created when interval is set
 26        private TimeSpan _recentTimeSpan;
 27        #endregion
 28
 29        #region Public Properties
 30        /// <summary>
 31        /// Interval, in milliseconds, within which events are considered "recent".
 32        /// </summary>
 33        [PublicAPI]
 34        public int Interval
 35        {
 036            get => _interval;
 37            set
 038            {
 039                _interval = value;
 40
 41                // Set timespan based on the value passed
 042                _recentTimeSpan = new TimeSpan(0, 0, 0, 0, value);
 043            }
 44        }
 45
 46        /// <summary>
 47        /// Allows user to set whether to filter recent events.
 48        /// If this is set a false, this class behaves like System.IO.FileSystemWatcher class.
 49        /// </summary>
 50        [PublicAPI]
 051        public bool FilterRecentEvents { get; set; }
 52        #endregion
 53
 54        #region Constructors
 55        /// <summary>
 56        /// Initializes a new instance of the <see cref="EnhancedFileSystemWatcher"/> class.
 57        /// </summary>
 58        /// <param name="interval">The interval.</param>
 059        public EnhancedFileSystemWatcher(int interval = DefaultWatchInterval)
 060        {
 061            Check.Condition(interval, i => i >= 0, nameof(interval));
 62
 063            InitializeMembers(interval);
 064        }
 65
 66        /// <summary>
 67        /// Initializes a new instance of the <see cref="EnhancedFileSystemWatcher"/> class.
 68        /// </summary>
 69        /// <param name="path">The directory to monitor, in standard or Universal Naming Convention (UNC) notation.</par
 70        /// <param name="interval">The interval.</param>
 071        public EnhancedFileSystemWatcher([NotNull] string path, int interval = DefaultWatchInterval) : base(path)
 072        {
 073            Check.NotNullOrEmpty(path, nameof(path));
 074            Check.Condition(interval, i => i >= 0, nameof(interval));
 75
 076            InitializeMembers(interval);
 077        }
 78
 79        /// <summary>
 80        /// Initializes a new instance of the <see cref="EnhancedFileSystemWatcher"/> class.
 81        /// </summary>
 82        /// <param name="path">The directory to monitor, in standard or Universal Naming Convention (UNC) notation.</par
 83        /// <param name="filter">The type of files to watch. For example, "*.txt" watches for changes to all text files.
 84        /// <param name="interval">The interval.</param>
 085        public EnhancedFileSystemWatcher([NotNull] string path, [NotNull] string filter, int interval = DefaultWatchInte
 086        {
 087            Check.NotNullOrEmpty(path, nameof(path));
 088            Check.NotNullOrEmpty(filter, nameof(filter));
 089            Check.Condition(interval, i => i >= 0, nameof(interval));
 90
 091            InitializeMembers(interval);
 092        }
 93        #endregion
 94
 95        #region Events
 96        // These events hide the events from the base class.
 97        // We want to raise these events appropriately and we do not want the
 98        // users of this class subscribing to these events of the base class accidentally
 99
 100        /// <summary>
 101        /// Occurs when a file or directory in the specified <see cref="P:System.IO.FileSystemWatcher.Path" /> is change
 102        /// </summary>
 103        public new event FileSystemEventHandler Changed;
 104
 105        /// <summary>
 106        /// Occurs when a file or directory in the specified <see cref="P:System.IO.FileSystemWatcher.Path" /> is create
 107        /// </summary>
 108        public new event FileSystemEventHandler Created;
 109
 110        /// <summary>
 111        /// Occurs when a file or directory in the specified <see cref="P:System.IO.FileSystemWatcher.Path" /> is delete
 112        /// </summary>
 113        public new event FileSystemEventHandler Deleted;
 114
 115        /// <summary>
 116        /// Occurs when a file or directory in the specified <see cref="P:System.IO.FileSystemWatcher.Path" /> is rename
 117        /// </summary>
 118        public new event RenamedEventHandler Renamed;
 119        #endregion
 120
 121        #region Protected Methods to raise the Events for this class
 122        /// <summary>
 123        /// Raises the <see cref="E:System.IO.FileSystemWatcher.Changed" /> event.
 124        /// </summary>
 125        /// <param name="e">A <see cref="T:System.IO.FileSystemEventArgs" /> that contains the event data.</param>
 126        protected new virtual void OnChanged(FileSystemEventArgs e)
 0127        {
 0128            Changed?.Invoke(this, e);
 0129        }
 130
 131        /// <summary>
 132        /// Raises the <see cref="E:System.IO.FileSystemWatcher.Created" /> event.
 133        /// </summary>
 134        /// <param name="e">A <see cref="T:System.IO.FileSystemEventArgs" /> that contains the event data.</param>
 135        protected new virtual void OnCreated(FileSystemEventArgs e)
 0136        {
 0137            Created?.Invoke(this, e);
 0138        }
 139
 140        /// <summary>
 141        /// Raises the <see cref="E:System.IO.FileSystemWatcher.Deleted" /> event.
 142        /// </summary>
 143        /// <param name="e">A <see cref="T:System.IO.FileSystemEventArgs" /> that contains the event data.</param>
 144        protected new virtual void OnDeleted(FileSystemEventArgs e)
 0145        {
 0146            Deleted?.Invoke(this, e);
 0147        }
 148
 149        /// <summary>
 150        /// Raises the <see cref="E:System.IO.FileSystemWatcher.Renamed" /> event.
 151        /// </summary>
 152        /// <param name="e">A <see cref="T:System.IO.RenamedEventArgs" /> that contains the event data.</param>
 153        protected new virtual void OnRenamed(RenamedEventArgs e)
 0154        {
 0155            Renamed?.Invoke(this, e);
 0156        }
 157        #endregion
 158
 159        #region Private Methods
 160        /// <summary>
 161        /// This Method Initializes the private members.
 162        /// Interval is set to its default value of 100 millisecond.
 163        /// FilterRecentEvents is set to true, _lastFileEvent dictionary is initialized.
 164        /// We subscribe to the base class events.
 165        /// </summary>
 166        private void InitializeMembers(int interval = 100)
 0167        {
 0168            Interval = interval;
 0169            FilterRecentEvents = true;
 0170            _lastFileEvent = new ConcurrentDictionary<string, DateTime>();
 171
 0172            base.Created += OnCreated;
 0173            base.Changed += OnChanged;
 0174            base.Deleted += OnDeleted;
 0175            base.Renamed += OnRenamed;
 0176        }
 177
 178        /// <summary>
 179        /// This method searches the dictionary to find out when the last event occured
 180        /// for a particular file. If that event occured within the specified timespan
 181        /// it returns true, else false
 182        /// </summary>
 183        /// <param name="fileName">The filename to be checked</param>
 184        /// <returns>True if an event has occured within the specified interval, False otherwise</returns>
 185        private bool HasAnotherFileEventOccuredRecently(string fileName)
 0186        {
 187            // Check dictionary only if user wants to filter recent events otherwise return value stays false.
 0188            if (!FilterRecentEvents)
 0189            {
 0190                return false;
 191            }
 192
 0193            bool retVal = false;
 0194            if (_lastFileEvent.ContainsKey(fileName))
 0195            {
 196                // If dictionary contains the filename, check how much time has elapsed
 197                // since the last event occured. If the timespan is less that the
 198                // specified interval, set return value to true
 199                // and store current datetime in dictionary for this file
 0200                DateTime lastEventTime = _lastFileEvent[fileName];
 0201                DateTime currentTime = DateTime.Now;
 0202                TimeSpan timeSinceLastEvent = currentTime - lastEventTime;
 0203                retVal = timeSinceLastEvent < _recentTimeSpan;
 0204                _lastFileEvent[fileName] = currentTime;
 0205            }
 206            else
 0207            {
 208                // If dictionary does not contain the filename,
 209                // no event has occured in past for this file, so set return value to false
 210                // and append filename along with current datetime to the dictionary
 0211                _lastFileEvent.TryAdd(fileName, DateTime.Now);
 0212            }
 213
 0214            return retVal;
 0215        }
 216
 217        #region FileSystemWatcher EventHandlers
 218        // Base class Event Handlers. Check if an event has occured recently and call method
 219        // to raise appropriate event only if no recent event is detected
 220        private void OnChanged(object sender, FileSystemEventArgs e)
 0221        {
 0222            if (!HasAnotherFileEventOccuredRecently(e.FullPath))
 0223            {
 0224                OnChanged(e);
 0225            }
 0226        }
 227
 228        private void OnCreated(object sender, FileSystemEventArgs e)
 0229        {
 0230            if (!HasAnotherFileEventOccuredRecently(e.FullPath))
 0231            {
 0232                OnCreated(e);
 0233            }
 0234        }
 235
 236        private void OnDeleted(object sender, FileSystemEventArgs e)
 0237        {
 0238            if (!HasAnotherFileEventOccuredRecently(e.FullPath))
 0239            {
 0240                OnDeleted(e);
 0241            }
 0242        }
 243
 244        private void OnRenamed(object sender, RenamedEventArgs e)
 0245        {
 0246            if (!HasAnotherFileEventOccuredRecently(e.OldFullPath))
 0247            {
 0248                OnRenamed(e);
 0249            }
 0250        }
 251        #endregion
 252        #endregion
 253    }
 254}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Util\EnhancedFileSystemWatcher.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_ExactMatcher.htm b/report/coverlet/WireMock.Net_ExactMatcher.htm index e44590b5..5c9caf94 100644 --- a/report/coverlet/WireMock.Net_ExactMatcher.htm +++ b/report/coverlet/WireMock.Net_ExactMatcher.htm @@ -20,7 +20,7 @@ Covered lines:17 Uncovered lines:0 Coverable lines:17 -Total lines:54 +Total lines:0 Line coverage:100% @@ -36,66 +36,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\ExactMatcher.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System.Linq;
 2using JetBrains.Annotations;
 3using WireMock.Validation;
 4
 5namespace WireMock.Matchers
 6{
 7    /// <summary>
 8    /// ExactMatcher
 9    /// </summary>
 10    /// <seealso cref="IStringMatcher" />
 11    public class ExactMatcher : IStringMatcher
 12    {
 13        private readonly string[] _values;
 14
 15        /// <inheritdoc cref="IMatcher.MatchBehaviour"/>
 2316        public MatchBehaviour MatchBehaviour { get; }
 17
 18        /// <summary>
 19        /// Initializes a new instance of the <see cref="ExactMatcher"/> class.
 20        /// </summary>
 21        /// <param name="values">The values.</param>
 1522        public ExactMatcher([NotNull] params string[] values) : this(MatchBehaviour.AcceptOnMatch, values)
 1523        {
 1524        }
 25
 26        /// <summary>
 27        /// Initializes a new instance of the <see cref="ExactMatcher"/> class.
 28        /// </summary>
 29        /// <param name="matchBehaviour">The match behaviour.</param>
 30        /// <param name="values">The values.</param>
 3931        public ExactMatcher(MatchBehaviour matchBehaviour, [NotNull] params string[] values)
 3932        {
 3933            Check.HasNoNulls(values, nameof(values));
 34
 3935            _values = values;
 3936            MatchBehaviour = matchBehaviour;
 3937        }
 38
 39        /// <inheritdoc cref="IStringMatcher.IsMatch"/>
 40        public double IsMatch(string input)
 2341        {
 7042            return MatchBehaviourHelper.Convert(MatchBehaviour, MatchScores.ToScore(_values.Select(value => value.Equals
 2343        }
 44
 45        /// <inheritdoc cref="IStringMatcher.GetPatterns"/>
 46        public string[] GetPatterns()
 347        {
 348            return _values;
 349        }
 50
 51        /// <inheritdoc cref="IMatcher.Name"/>
 152        public string Name => "ExactMatcher";
 53    }
 54}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\ExactMatcher.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_ExactObjectMatcher.htm b/report/coverlet/WireMock.Net_ExactObjectMatcher.htm index 79119ca7..5b4f3e5f 100644 --- a/report/coverlet/WireMock.Net_ExactObjectMatcher.htm +++ b/report/coverlet/WireMock.Net_ExactObjectMatcher.htm @@ -20,7 +20,7 @@ Covered lines:24 Uncovered lines:0 Coverable lines:24 -Total lines:71 +Total lines:0 Line coverage:100% Branch coverage:100% @@ -38,83 +38,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\ExactObjectMatcher.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System.Linq;
 2using JetBrains.Annotations;
 3using WireMock.Validation;
 4
 5namespace WireMock.Matchers
 6{
 7    /// <summary>
 8    /// ExactObjectMatcher
 9    /// </summary>
 10    /// <seealso cref="IObjectMatcher" />
 11    public class ExactObjectMatcher : IObjectMatcher
 12    {
 13        private readonly object _object;
 14        private readonly byte[] _bytes;
 15
 16        /// <inheritdoc cref="IMatcher.MatchBehaviour"/>
 517        public MatchBehaviour MatchBehaviour { get; }
 18
 19        /// <summary>
 20        /// Initializes a new instance of the <see cref="ExactObjectMatcher"/> class.
 21        /// </summary>
 22        /// <param name="value">The value.</param>
 223        public ExactObjectMatcher([NotNull] object value) : this(MatchBehaviour.AcceptOnMatch, value)
 224        {
 225        }
 26
 27        /// <summary>
 28        /// Initializes a new instance of the <see cref="ExactObjectMatcher"/> class.
 29        /// </summary>
 30        /// <param name="matchBehaviour">The match behaviour.</param>
 31        /// <param name="value">The value.</param>
 432        public ExactObjectMatcher(MatchBehaviour matchBehaviour, [NotNull] object value)
 433        {
 434            Check.NotNull(value, nameof(value));
 35
 436            _object = value;
 437            MatchBehaviour = matchBehaviour;
 438        }
 39
 40        /// <summary>
 41        /// Initializes a new instance of the <see cref="ExactObjectMatcher"/> class.
 42        /// </summary>
 43        /// <param name="value">The value.</param>
 144        public ExactObjectMatcher([NotNull] byte[] value) : this(MatchBehaviour.AcceptOnMatch, value)
 145        {
 146        }
 47
 48        /// <summary>
 49        /// Initializes a new instance of the <see cref="ExactObjectMatcher"/> class.
 50        /// </summary>
 51        /// <param name="matchBehaviour">The match behaviour.</param>
 52        /// <param name="value">The value.</param>
 253        public ExactObjectMatcher(MatchBehaviour matchBehaviour, [NotNull] byte[] value)
 254        {
 255            Check.NotNull(value, nameof(value));
 56
 257            _bytes = value;
 258            MatchBehaviour = matchBehaviour;
 259        }
 60
 61        /// <inheritdoc cref="IObjectMatcher.IsMatch"/>
 62        public double IsMatch(object input)
 563        {
 564            bool equals = _object != null ? Equals(_object, input) : _bytes.SequenceEqual((byte[])input);
 565            return MatchBehaviourHelper.Convert(MatchBehaviour, MatchScores.ToScore(equals));
 566        }
 67
 68        /// <inheritdoc cref="IMatcher.Name"/>
 169        public string Name => "ExactObjectMatcher";
 70    }
 71}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\ExactObjectMatcher.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_FileHelper.htm b/report/coverlet/WireMock.Net_FileHelper.htm index 47891669..59d8fdb8 100644 --- a/report/coverlet/WireMock.Net_FileHelper.htm +++ b/report/coverlet/WireMock.Net_FileHelper.htm @@ -20,7 +20,7 @@ Covered lines:14 Uncovered lines:0 Coverable lines:14 -Total lines:34 +Total lines:0 Line coverage:100% Branch coverage:100% @@ -34,46 +34,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Util\FileHelper.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System.IO;
 2using System.Threading;
 3using JetBrains.Annotations;
 4using WireMock.Handlers;
 5using WireMock.Validation;
 6
 7namespace WireMock.Util
 8{
 9    internal static class FileHelper
 10    {
 11        private const int NumberOfRetries = 3;
 12        private const int DelayOnRetry = 500;
 13
 14        public static string ReadAllTextWithRetryAndDelay([NotNull] IFileSystemHandler filehandler, [NotNull] string pat
 215        {
 216            Check.NotNull(filehandler, nameof(filehandler));
 217            Check.NotNullOrEmpty(path, nameof(path));
 18
 1019            for (int i = 1; i <= NumberOfRetries; ++i)
 420            {
 21                try
 422                {
 423                    return filehandler.ReadMappingFile(path);
 24                }
 325                catch
 326                {
 327                    Thread.Sleep(DelayOnRetry);
 328                }
 329            }
 30
 131            throw new IOException();
 132        }
 33    }
 34}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Util\FileHelper.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_FluentMockServer.htm b/report/coverlet/WireMock.Net_FluentMockServer.htm index ebabe8ef..9e153f06 100644 --- a/report/coverlet/WireMock.Net_FluentMockServer.htm +++ b/report/coverlet/WireMock.Net_FluentMockServer.htm @@ -20,7 +20,7 @@ Covered lines:392 Uncovered lines:344 Coverable lines:736 -Total lines:1317 +Total lines:0 Line coverage:53.2% Branch coverage:53.2% @@ -95,1341 +95,12 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Server\FluentMockServer.Admin.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using System.IO;
 4using System.Linq;
 5using System.Net.Http;
 6using System.Text;
 7using System.Threading.Tasks;
 8using JetBrains.Annotations;
 9using Newtonsoft.Json;
 10using Newtonsoft.Json.Linq;
 11using WireMock.Admin.Mappings;
 12using WireMock.Admin.Scenarios;
 13using WireMock.Admin.Settings;
 14using WireMock.Http;
 15using WireMock.Logging;
 16using WireMock.Matchers;
 17using WireMock.Matchers.Request;
 18using WireMock.RequestBuilders;
 19using WireMock.ResponseBuilders;
 20using WireMock.ResponseProviders;
 21using WireMock.Serialization;
 22using WireMock.Settings;
 23using WireMock.Util;
 24using WireMock.Validation;
 25
 26namespace WireMock.Server
 27{
 28    /// <summary>
 29    /// The fluent mock server.
 30    /// </summary>
 31    public partial class FluentMockServer
 32    {
 33        private const int EnhancedFileSystemWatcherTimeoutMs = 1000;
 34        private const int AdminPriority = int.MinValue;
 35        private const int ProxyPriority = 1000;
 36        private const string ContentTypeJson = "application/json";
 37        private const string AdminMappings = "/__admin/mappings";
 38        private const string AdminRequests = "/__admin/requests";
 39        private const string AdminSettings = "/__admin/settings";
 40        private const string AdminScenarios = "/__admin/scenarios";
 41
 4742        private readonly RegexMatcher _adminMappingsGuidPathMatcher = new RegexMatcher(MatchBehaviour.AcceptOnMatch, @"^
 4743        private readonly RegexMatcher _adminRequestsGuidPathMatcher = new RegexMatcher(MatchBehaviour.AcceptOnMatch, @"^
 44
 4745        private readonly JsonSerializerSettings _settings = new JsonSerializerSettings
 4746        {
 4747            Formatting = Formatting.Indented,
 4748            NullValueHandling = NullValueHandling.Ignore
 4749        };
 50
 4751        private readonly JsonSerializerSettings _settingsIncludeNullValues = new JsonSerializerSettings
 4752        {
 4753            Formatting = Formatting.Indented,
 4754            NullValueHandling = NullValueHandling.Include
 4755        };
 56
 57        #region InitAdmin
 58        private void InitAdmin()
 1159        {
 60            // __admin/settings
 1161            Given(Request.Create().WithPath(AdminSettings).UsingGet()).AtPriority(AdminPriority).RespondWith(new Dynamic
 1162            Given(Request.Create().WithPath(AdminSettings).UsingMethod("PUT", "POST").WithHeader(HttpKnownHeaderNames.Co
 63
 64            // __admin/mappings
 1165            Given(Request.Create().WithPath(AdminMappings).UsingGet()).AtPriority(AdminPriority).RespondWith(new Dynamic
 1166            Given(Request.Create().WithPath(AdminMappings).UsingPost().WithHeader(HttpKnownHeaderNames.ContentType, Cont
 1167            Given(Request.Create().WithPath(AdminMappings).UsingDelete()).AtPriority(AdminPriority).RespondWith(new Dyna
 68
 69            // __admin/mappings/reset
 1170            Given(Request.Create().WithPath(AdminMappings + "/reset").UsingPost()).AtPriority(AdminPriority).RespondWith
 71
 72            // __admin/mappings/{guid}
 1173            Given(Request.Create().WithPath(_adminMappingsGuidPathMatcher).UsingGet()).AtPriority(AdminPriority).Respond
 1174            Given(Request.Create().WithPath(_adminMappingsGuidPathMatcher).UsingPut().WithHeader(HttpKnownHeaderNames.Co
 1175            Given(Request.Create().WithPath(_adminMappingsGuidPathMatcher).UsingDelete()).AtPriority(AdminPriority).Resp
 76
 77            // __admin/mappings/save
 1178            Given(Request.Create().WithPath(AdminMappings + "/save").UsingPost()).AtPriority(AdminPriority).RespondWith(
 79
 80            // __admin/requests
 1181            Given(Request.Create().WithPath(AdminRequests).UsingGet()).AtPriority(AdminPriority).RespondWith(new Dynamic
 1182            Given(Request.Create().WithPath(AdminRequests).UsingDelete()).AtPriority(AdminPriority).RespondWith(new Dyna
 83
 84            // __admin/requests/reset
 1185            Given(Request.Create().WithPath(AdminRequests + "/reset").UsingPost()).AtPriority(AdminPriority).RespondWith
 86
 87            // __admin/request/{guid}
 1188            Given(Request.Create().WithPath(_adminRequestsGuidPathMatcher).UsingGet()).AtPriority(AdminPriority).Respond
 1189            Given(Request.Create().WithPath(_adminRequestsGuidPathMatcher).UsingDelete()).AtPriority(AdminPriority).Resp
 90
 91            // __admin/requests/find
 1192            Given(Request.Create().WithPath(AdminRequests + "/find").UsingPost()).AtPriority(AdminPriority).RespondWith(
 93
 94            // __admin/scenarios
 1195            Given(Request.Create().WithPath(AdminScenarios).UsingGet()).AtPriority(AdminPriority).RespondWith(new Dynami
 1196            Given(Request.Create().WithPath(AdminScenarios).UsingDelete()).AtPriority(AdminPriority).RespondWith(new Dyn
 97
 98            // __admin/scenarios/reset
 1199            Given(Request.Create().WithPath(AdminScenarios + "/reset").UsingPost()).AtPriority(AdminPriority).RespondWit
 11100        }
 101        #endregion
 102
 103        #region StaticMappings
 104        /// <summary>
 105        /// Saves the static mappings.
 106        /// </summary>
 107        /// <param name="folder">The optional folder. If not defined, use {CurrentFolder}/__admin/mappings</param>
 108        [PublicAPI]
 109        public void SaveStaticMappings([CanBeNull] string folder = null)
 1110        {
 6111            foreach (var mapping in Mappings.Where(m => !m.IsAdminInterface))
 1112            {
 1113                SaveMappingToFile(mapping, folder);
 1114            }
 1115        }
 116
 117        /// <summary>
 118        /// Reads the static mappings from a folder.
 119        /// </summary>
 120        /// <param name="folder">The optional folder. If not defined, use {CurrentFolder}/__admin/mappings</param>
 121        [PublicAPI]
 122        public void ReadStaticMappings([CanBeNull] string folder = null)
 4123        {
 4124            if (folder == null)
 1125            {
 1126                folder = _fileSystemHandler.GetMappingFolder();
 1127            }
 128
 4129            if (!_fileSystemHandler.FolderExists(folder))
 1130            {
 1131                _logger.Info("The Static Mapping folder '{0}' does not exist, reading Static MappingFiles will be skippe
 1132                return;
 133            }
 134
 27135            foreach (string filename in _fileSystemHandler.EnumerateFiles(folder).OrderBy(f => f))
 6136            {
 6137                _logger.Info("Reading Static MappingFile : '{0}'", filename);
 138
 139                try
 6140                {
 6141                    ReadStaticMappingAndAddOrUpdate(filename);
 6142                }
 0143                catch
 0144                {
 0145                    _logger.Error("Static MappingFile : '{0}' could not be read. This file will be skipped.", filename);
 0146                }
 6147            }
 4148        }
 149
 150        /// <summary>
 151        /// Watches the static mappings for changes.
 152        /// </summary>
 153        /// <param name="folder">The optional folder. If not defined, use {CurrentFolder}/__admin/mappings</param>
 154        [PublicAPI]
 155        public void WatchStaticMappings([CanBeNull] string folder = null)
 1156        {
 1157            if (folder == null)
 1158            {
 1159                folder = _fileSystemHandler.GetMappingFolder();
 1160            }
 161
 1162            if (!_fileSystemHandler.FolderExists(folder))
 1163            {
 1164                return;
 165            }
 166
 0167            _logger.Info("Watching folder '{0}' for new, updated and deleted MappingFiles.", folder);
 168
 0169            var watcher = new EnhancedFileSystemWatcher(folder, "*.json", EnhancedFileSystemWatcherTimeoutMs);
 0170            watcher.Created += (sender, args) =>
 0171            {
 0172                _logger.Info("New MappingFile created : '{0}'", args.FullPath);
 0173                ReadStaticMappingAndAddOrUpdate(args.FullPath);
 0174            };
 0175            watcher.Changed += (sender, args) =>
 0176            {
 0177                _logger.Info("New MappingFile updated : '{0}'", args.FullPath);
 0178                ReadStaticMappingAndAddOrUpdate(args.FullPath);
 0179            };
 0180            watcher.Deleted += (sender, args) =>
 0181            {
 0182                _logger.Info("New MappingFile deleted : '{0}'", args.FullPath);
 0183                string filenameWithoutExtension = Path.GetFileNameWithoutExtension(args.FullPath);
 0184
 0185                if (Guid.TryParse(filenameWithoutExtension, out Guid guidFromFilename))
 0186                {
 0187                    DeleteMapping(guidFromFilename);
 0188                }
 0189                else
 0190                {
 0191                    DeleteMapping(args.FullPath);
 0192                }
 0193            };
 194
 0195            watcher.EnableRaisingEvents = true;
 1196        }
 197
 198        /// <summary>
 199        /// Reads a static mapping file and adds or updates the mapping.
 200        /// </summary>
 201        /// <param name="path">The path.</param>
 202        [PublicAPI]
 203        public void ReadStaticMappingAndAddOrUpdate([NotNull] string path)
 10204        {
 10205            Check.NotNull(path, nameof(path));
 206
 10207            string filenameWithoutExtension = Path.GetFileNameWithoutExtension(path);
 208
 10209            MappingModel mappingModel = JsonConvert.DeserializeObject<MappingModel>(_fileSystemHandler.ReadMappingFile(p
 10210            if (Guid.TryParse(filenameWithoutExtension, out Guid guidFromFilename))
 6211            {
 6212                DeserializeAndAddOrUpdateMapping(mappingModel, guidFromFilename, path);
 6213            }
 214            else
 4215            {
 4216                DeserializeAndAddOrUpdateMapping(mappingModel, null, path);
 4217            }
 10218        }
 219        #endregion
 220
 221        #region Proxy and Record
 222        private HttpClient _httpClientForProxy;
 223
 224        private void InitProxyAndRecord(IFluentMockServerSettings settings)
 2225        {
 2226            _httpClientForProxy = HttpClientHelper.CreateHttpClient(settings.ProxyAndRecordSettings.ClientX509Certificat
 227
 2228            var respondProvider = Given(Request.Create().WithPath("/*").UsingAnyMethod());
 2229            if (settings.StartAdminInterface == true)
 1230            {
 1231                respondProvider.AtPriority(ProxyPriority);
 1232            }
 233
 2234            respondProvider.RespondWith(new ProxyAsyncResponseProvider(ProxyAndRecordAsync, settings.ProxyAndRecordSetti
 2235        }
 236
 237        private async Task<ResponseMessage> ProxyAndRecordAsync(RequestMessage requestMessage, IProxyAndRecordSettings s
 0238        {
 0239            var requestUri = new Uri(requestMessage.Url);
 0240            var proxyUri = new Uri(settings.Url);
 0241            var proxyUriWithRequestPathAndQuery = new Uri(proxyUri, requestUri.PathAndQuery);
 242
 0243            var responseMessage = await HttpClientHelper.SendAsync(_httpClientForProxy, requestMessage, proxyUriWithRequ
 244
 0245            if (settings.SaveMapping)
 0246            {
 0247                var mapping = ToMapping(requestMessage, responseMessage, settings.BlackListedHeaders ?? new string[] { }
 0248                _options.Mappings.TryAdd(mapping.Guid, mapping);
 249
 0250                if (settings.SaveMappingToFile)
 0251                {
 0252                    SaveMappingToFile(mapping);
 0253                }
 0254            }
 255
 0256            return responseMessage;
 0257        }
 258
 259        private IMapping ToMapping(RequestMessage requestMessage, ResponseMessage responseMessage, string[] blacklistedH
 0260        {
 0261            var request = Request.Create();
 0262            request.WithPath(requestMessage.Path);
 0263            request.UsingMethod(requestMessage.Method);
 264
 0265            requestMessage.Query.Loop((key, value) => request.WithParam(key, value.ToArray()));
 0266            requestMessage.Cookies.Loop((key, value) => request.WithCookie(key, value));
 267
 0268            var allBlackListedHeaders = new List<string>(blacklistedHeaders) { "Cookie" };
 0269            requestMessage.Headers.Loop((key, value) =>
 0270            {
 0271                if (!allBlackListedHeaders.Any(b => string.Equals(key, b, StringComparison.OrdinalIgnoreCase)))
 0272                {
 0273                    request.WithHeader(key, value.ToArray());
 0274                }
 0275            });
 276
 0277            if (requestMessage.BodyAsJson != null)
 0278            {
 0279                request.WithBody(new JsonMatcher(MatchBehaviour.AcceptOnMatch, requestMessage.BodyAsJson));
 0280            }
 0281            else if (requestMessage.Body != null)
 0282            {
 0283                request.WithBody(new ExactMatcher(MatchBehaviour.AcceptOnMatch, requestMessage.Body));
 0284            }
 285
 0286            var response = Response.Create(responseMessage);
 287
 0288            return new Mapping(Guid.NewGuid(), string.Empty, null, request, response, 0, null, null, null);
 0289        }
 290        #endregion
 291
 292        #region Settings
 293        private ResponseMessage SettingsGet(RequestMessage requestMessage)
 1294        {
 1295            var model = new SettingsModel
 1296            {
 1297                AllowPartialMapping = _options.AllowPartialMapping,
 1298                MaxRequestLogCount = _options.MaxRequestLogCount,
 1299                RequestLogExpirationDuration = _options.RequestLogExpirationDuration,
 1300                GlobalProcessingDelay = (int?)_options.RequestProcessingDelay?.TotalMilliseconds
 1301            };
 302
 1303            return ToJson(model);
 1304        }
 305
 306        private ResponseMessage SettingsUpdate(RequestMessage requestMessage)
 2307        {
 2308            var settings = DeserializeObject<SettingsModel>(requestMessage);
 2309            _options.MaxRequestLogCount = settings.MaxRequestLogCount;
 2310            _options.RequestLogExpirationDuration = settings.RequestLogExpirationDuration;
 311
 2312            if (settings.AllowPartialMapping != null)
 0313            {
 0314                _options.AllowPartialMapping = settings.AllowPartialMapping.Value;
 0315            }
 316
 2317            if (settings.GlobalProcessingDelay != null)
 0318            {
 0319                _options.RequestProcessingDelay = TimeSpan.FromMilliseconds(settings.GlobalProcessingDelay.Value);
 0320            }
 321
 2322            return ResponseMessageBuilder.Create("Settings updated");
 2323        }
 324        #endregion Settings
 325
 326        #region Mapping/{guid}
 327        private ResponseMessage MappingGet(RequestMessage requestMessage)
 0328        {
 0329            Guid guid = Guid.Parse(requestMessage.Path.Substring(AdminMappings.Length + 1));
 0330            var mapping = Mappings.FirstOrDefault(m => !m.IsAdminInterface && m.Guid == guid);
 331
 0332            if (mapping == null)
 0333            {
 0334                _logger.Warn("HttpStatusCode set to 404 : Mapping not found");
 0335                return ResponseMessageBuilder.Create("Mapping not found", 404);
 336            }
 337
 0338            var model = MappingConverter.ToMappingModel(mapping);
 339
 0340            return ToJson(model);
 0341        }
 342
 343        private ResponseMessage MappingPut(RequestMessage requestMessage)
 0344        {
 0345            Guid guid = Guid.Parse(requestMessage.Path.TrimStart(AdminMappings.ToCharArray()));
 346
 0347            var mappingModel = DeserializeObject<MappingModel>(requestMessage);
 0348            Guid? guidFromPut = DeserializeAndAddOrUpdateMapping(mappingModel, guid);
 349
 0350            return ResponseMessageBuilder.Create("Mapping added or updated", 200, guidFromPut);
 0351        }
 352
 353        private ResponseMessage MappingDelete(RequestMessage requestMessage)
 0354        {
 0355            Guid guid = Guid.Parse(requestMessage.Path.Substring(AdminMappings.Length + 1));
 356
 0357            if (DeleteMapping(guid))
 0358            {
 0359                return ResponseMessageBuilder.Create("Mapping removed", 200, guid);
 360            }
 361
 0362            return ResponseMessageBuilder.Create("Mapping not found", 404);
 0363        }
 364        #endregion Mapping/{guid}
 365
 366        #region Mappings
 367        private ResponseMessage MappingsSave(RequestMessage requestMessage)
 0368        {
 0369            SaveStaticMappings();
 370
 0371            return ResponseMessageBuilder.Create("Mappings saved to disk");
 0372        }
 373
 374        private void SaveMappingToFile(IMapping mapping, string folder = null)
 1375        {
 1376            if (folder == null)
 1377            {
 1378                folder = _fileSystemHandler.GetMappingFolder();
 1379            }
 380
 1381            if (!_fileSystemHandler.FolderExists(folder))
 0382            {
 0383                _fileSystemHandler.CreateFolder(folder);
 0384            }
 385
 1386            var model = MappingConverter.ToMappingModel(mapping);
 1387            string filename = (!string.IsNullOrEmpty(mapping.Title) ? SanitizeFileName(mapping.Title) : mapping.Guid.ToS
 388
 1389            string path = Path.Combine(folder, filename);
 390
 1391            _logger.Info("Saving Mapping file {0}", filename);
 392
 1393            _fileSystemHandler.WriteMappingFile(path, JsonConvert.SerializeObject(model, _settings));
 1394        }
 395
 396        private static string SanitizeFileName(string name, char replaceChar = '_')
 0397        {
 0398            return Path.GetInvalidFileNameChars().Aggregate(name, (current, c) => current.Replace(c, replaceChar));
 0399        }
 400
 401        private ResponseMessage MappingsGet(RequestMessage requestMessage)
 0402        {
 0403            var result = new List<MappingModel>();
 0404            foreach (var mapping in Mappings.Where(m => !m.IsAdminInterface))
 0405            {
 0406                var model = MappingConverter.ToMappingModel(mapping);
 0407                result.Add(model);
 0408            }
 409
 0410            return ToJson(result);
 0411        }
 412
 413        private ResponseMessage MappingsPost(RequestMessage requestMessage)
 1414        {
 415            Guid? guid;
 416            try
 1417            {
 1418                var mappingModel = DeserializeObject<MappingModel>(requestMessage);
 1419                guid = DeserializeAndAddOrUpdateMapping(mappingModel);
 1420            }
 0421            catch (ArgumentException a)
 0422            {
 0423                _logger.Error("HttpStatusCode set to 400 {0}", a);
 0424                return ResponseMessageBuilder.Create(a.Message, 400);
 425            }
 0426            catch (Exception e)
 0427            {
 0428                _logger.Error("HttpStatusCode set to 500 {0}", e);
 0429                return ResponseMessageBuilder.Create(e.ToString(), 500);
 430            }
 431
 1432            return ResponseMessageBuilder.Create("Mapping added", 201, guid);
 1433        }
 434
 435        private Guid? DeserializeAndAddOrUpdateMapping(MappingModel mappingModel, Guid? guid = null, string path = null)
 11436        {
 11437            Check.NotNull(mappingModel, nameof(mappingModel));
 11438            Check.NotNull(mappingModel.Request, nameof(mappingModel.Request));
 11439            Check.NotNull(mappingModel.Response, nameof(mappingModel.Response));
 440
 11441            var requestBuilder = InitRequestBuilder(mappingModel.Request, true);
 11442            if (requestBuilder == null)
 0443            {
 0444                return null;
 445            }
 446
 11447            var responseBuilder = InitResponseBuilder(mappingModel.Response);
 448
 11449            var respondProvider = Given(requestBuilder);
 450
 11451            if (guid != null)
 6452            {
 6453                respondProvider = respondProvider.WithGuid(guid.Value);
 6454            }
 5455            else if (mappingModel.Guid != null && mappingModel.Guid != Guid.Empty)
 3456            {
 3457                respondProvider = respondProvider.WithGuid(mappingModel.Guid.Value);
 3458            }
 459
 11460            if (path != null)
 10461            {
 10462                respondProvider = respondProvider.WithPath(path);
 10463            }
 464
 11465            if (!string.IsNullOrEmpty(mappingModel.Title))
 4466            {
 4467                respondProvider = respondProvider.WithTitle(mappingModel.Title);
 4468            }
 469
 11470            if (mappingModel.Priority != null)
 10471            {
 10472                respondProvider = respondProvider.AtPriority(mappingModel.Priority.Value);
 10473            }
 474
 11475            if (mappingModel.Scenario != null)
 0476            {
 0477                respondProvider = respondProvider.InScenario(mappingModel.Scenario);
 0478                respondProvider = respondProvider.WhenStateIs(mappingModel.WhenStateIs);
 0479                respondProvider = respondProvider.WillSetStateTo(mappingModel.SetStateTo);
 0480            }
 481
 11482            respondProvider.RespondWith(responseBuilder);
 483
 11484            return respondProvider.Guid;
 11485        }
 486
 487        private ResponseMessage MappingsDelete(RequestMessage requestMessage)
 0488        {
 0489            ResetMappings();
 490
 0491            ResetScenarios();
 492
 0493            return ResponseMessageBuilder.Create("Mappings deleted");
 0494        }
 495        #endregion Mappings
 496
 497        #region Request/{guid}
 498        private ResponseMessage RequestGet(RequestMessage requestMessage)
 0499        {
 0500            Guid guid = Guid.Parse(requestMessage.Path.Substring(AdminRequests.Length + 1));
 0501            var entry = LogEntries.FirstOrDefault(r => !r.RequestMessage.Path.StartsWith("/__admin/") && r.Guid == guid)
 502
 0503            if (entry == null)
 0504            {
 0505                _logger.Warn("HttpStatusCode set to 404 : Request not found");
 0506                return ResponseMessageBuilder.Create("Request not found", 404);
 507            }
 508
 0509            var model = LogEntryMapper.Map(entry);
 510
 0511            return ToJson(model);
 0512        }
 513
 514        private ResponseMessage RequestDelete(RequestMessage requestMessage)
 0515        {
 0516            Guid guid = Guid.Parse(requestMessage.Path.Substring(AdminRequests.Length + 1));
 517
 0518            if (DeleteLogEntry(guid))
 0519            {
 0520                return ResponseMessageBuilder.Create("Request removed");
 521            }
 522
 0523            return ResponseMessageBuilder.Create("Request not found", 404);
 0524        }
 525        #endregion Request/{guid}
 526
 527        #region Requests
 528        private ResponseMessage RequestsGet(RequestMessage requestMessage)
 3529        {
 3530            var result = LogEntries
 6531                .Where(r => !r.RequestMessage.Path.StartsWith("/__admin/"))
 3532                .Select(LogEntryMapper.Map);
 533
 3534            return ToJson(result);
 3535        }
 536
 537        private ResponseMessage RequestsDelete(RequestMessage requestMessage)
 0538        {
 0539            ResetLogEntries();
 540
 0541            return ResponseMessageBuilder.Create("Requests deleted");
 0542        }
 543        #endregion Requests
 544
 545        #region Requests/find
 546        private ResponseMessage RequestsFind(RequestMessage requestMessage)
 1547        {
 1548            var requestModel = DeserializeObject<RequestModel>(requestMessage);
 549
 1550            var request = (Request)InitRequestBuilder(requestModel, false);
 551
 1552            var dict = new Dictionary<LogEntry, RequestMatchResult>();
 6553            foreach (var logEntry in LogEntries.Where(le => !le.RequestMessage.Path.StartsWith("/__admin/")))
 1554            {
 1555                var requestMatchResult = new RequestMatchResult();
 1556                if (request.GetMatchingScore(logEntry.RequestMessage, requestMatchResult) > MatchScores.AlmostPerfect)
 1557                {
 1558                    dict.Add(logEntry, requestMatchResult);
 1559                }
 1560            }
 561
 3562            var result = dict.OrderBy(x => x.Value.AverageTotalScore).Select(x => x.Key).Select(LogEntryMapper.Map);
 563
 1564            return ToJson(result);
 1565        }
 566        #endregion Requests/find
 567
 568        #region Scenarios
 569        private ResponseMessage ScenariosGet(RequestMessage requestMessage)
 0570        {
 0571            var scenariosStates = Scenarios.Values.Select(s => new ScenarioStateModel
 0572            {
 0573                Name = s.Name,
 0574                NextState = s.NextState,
 0575                Started = s.Started,
 0576                Finished = s.Finished
 0577            });
 578
 0579            return ToJson(scenariosStates, true);
 0580        }
 581
 582        private ResponseMessage ScenariosReset(RequestMessage requestMessage)
 0583        {
 0584            ResetScenarios();
 585
 0586            return ResponseMessageBuilder.Create("Scenarios reset");
 0587        }
 588        #endregion
 589
 590        private IRequestBuilder InitRequestBuilder(RequestModel requestModel, bool pathOrUrlRequired)
 12591        {
 12592            IRequestBuilder requestBuilder = Request.Create();
 593
 12594            if (requestModel.ClientIP != null)
 0595            {
 0596                if (requestModel.ClientIP is string clientIP)
 0597                {
 0598                    requestBuilder = requestBuilder.WithClientIP(clientIP);
 0599                }
 600                else
 0601                {
 0602                    var clientIPModel = JsonUtils.ParseJTokenToObject<ClientIPModel>(requestModel.ClientIP);
 0603                    if (clientIPModel?.Matchers != null)
 0604                    {
 0605                        requestBuilder = requestBuilder.WithPath(clientIPModel.Matchers.Select(MatcherMapper.Map).Cast<I
 0606                    }
 0607                }
 0608            }
 609
 12610            bool pathOrUrlmatchersValid = false;
 12611            if (requestModel.Path != null)
 11612            {
 11613                if (requestModel.Path is string path)
 1614                {
 1615                    requestBuilder = requestBuilder.WithPath(path);
 1616                    pathOrUrlmatchersValid = true;
 1617                }
 618                else
 10619                {
 10620                    var pathModel = JsonUtils.ParseJTokenToObject<PathModel>(requestModel.Path);
 10621                    if (pathModel?.Matchers != null)
 10622                    {
 10623                        requestBuilder = requestBuilder.WithPath(pathModel.Matchers.Select(MatcherMapper.Map).Cast<IStri
 10624                        pathOrUrlmatchersValid = true;
 10625                    }
 10626                }
 11627            }
 1628            else if (requestModel.Url != null)
 0629            {
 0630                if (requestModel.Url is string url)
 0631                {
 0632                    requestBuilder = requestBuilder.WithUrl(url);
 0633                    pathOrUrlmatchersValid = true;
 0634                }
 635                else
 0636                {
 0637                    var urlModel = JsonUtils.ParseJTokenToObject<UrlModel>(requestModel.Url);
 0638                    if (urlModel?.Matchers != null)
 0639                    {
 0640                        requestBuilder = requestBuilder.WithUrl(urlModel.Matchers.Select(MatcherMapper.Map).Cast<IString
 0641                        pathOrUrlmatchersValid = true;
 0642                    }
 0643                }
 0644            }
 645
 12646            if (pathOrUrlRequired && !pathOrUrlmatchersValid)
 0647            {
 0648                _logger.Error("Path or Url matcher is missing for this mapping, this mapping will not be added.");
 0649                return null;
 650            }
 651
 12652            if (requestModel.Methods != null)
 11653            {
 11654                requestBuilder = requestBuilder.UsingMethod(requestModel.Methods);
 11655            }
 656
 12657            if (requestModel.Headers != null)
 0658            {
 0659                foreach (var headerModel in requestModel.Headers.Where(h => h.Matchers != null))
 0660                {
 0661                    requestBuilder = requestBuilder.WithHeader(headerModel.Name, headerModel.Matchers.Select(MatcherMapp
 0662                }
 0663            }
 664
 12665            if (requestModel.Cookies != null)
 0666            {
 0667                foreach (var cookieModel in requestModel.Cookies.Where(c => c.Matchers != null))
 0668                {
 0669                    requestBuilder = requestBuilder.WithCookie(cookieModel.Name, cookieModel.Matchers.Select(MatcherMapp
 0670                }
 0671            }
 672
 12673            if (requestModel.Params != null)
 0674            {
 0675                foreach (var paramModel in requestModel.Params.Where(c => c.Matchers != null))
 0676                {
 0677                    requestBuilder = requestBuilder.WithParam(paramModel.Name, paramModel.Matchers.Select(MatcherMapper.
 0678                }
 0679            }
 680
 12681            if (requestModel.Body?.Matcher != null)
 3682            {
 3683                var bodyMatcher = MatcherMapper.Map(requestModel.Body.Matcher);
 3684                requestBuilder = requestBuilder.WithBody(bodyMatcher);
 3685            }
 686
 12687            return requestBuilder;
 12688        }
 689
 690        private IResponseBuilder InitResponseBuilder(ResponseModel responseModel)
 11691        {
 11692            IResponseBuilder responseBuilder = Response.Create();
 693
 11694            if (responseModel.Delay > 0)
 0695            {
 0696                responseBuilder = responseBuilder.WithDelay(responseModel.Delay.Value);
 0697            }
 698
 11699            if (!string.IsNullOrEmpty(responseModel.ProxyUrl))
 0700            {
 0701                if (string.IsNullOrEmpty(responseModel.X509Certificate2ThumbprintOrSubjectName))
 0702                {
 0703                    return responseBuilder.WithProxy(responseModel.ProxyUrl);
 704                }
 705
 0706                return responseBuilder.WithProxy(responseModel.ProxyUrl, responseModel.X509Certificate2ThumbprintOrSubje
 707            }
 708
 11709            if (responseModel.StatusCode.HasValue)
 10710            {
 10711                responseBuilder = responseBuilder.WithStatusCode(responseModel.StatusCode.Value);
 10712            }
 713
 11714            if (responseModel.Headers != null)
 9715            {
 189716                foreach (var entry in responseModel.Headers)
 81717                {
 81718                    responseBuilder = entry.Value is string value ?
 81719                        responseBuilder.WithHeader(entry.Key, value) :
 81720                        responseBuilder.WithHeader(entry.Key, JsonUtils.ParseJTokenToObject<string[]>(entry.Value));
 81721                }
 9722            }
 2723            else if (responseModel.HeadersRaw != null)
 0724            {
 0725                foreach (string headerLine in responseModel.HeadersRaw.Split(new[] { "\n", "\r\n" }, StringSplitOptions.
 0726                {
 0727                    int indexColon = headerLine.IndexOf(":", StringComparison.Ordinal);
 0728                    string key = headerLine.Substring(0, indexColon).TrimStart(' ', '\t');
 0729                    string value = headerLine.Substring(indexColon + 1).TrimStart(' ', '\t');
 0730                    responseBuilder = responseBuilder.WithHeader(key, value);
 0731                }
 0732            }
 733
 11734            if (responseModel.BodyAsBytes != null)
 0735            {
 0736                responseBuilder = responseBuilder.WithBody(responseModel.BodyAsBytes, responseModel.BodyDestination, ToE
 0737            }
 11738            else if (responseModel.Body != null)
 7739            {
 7740                responseBuilder = responseBuilder.WithBody(responseModel.Body, responseModel.BodyDestination, ToEncoding
 7741            }
 4742            else if (responseModel.BodyAsJson != null)
 1743            {
 1744                responseBuilder = responseBuilder.WithBodyAsJson(responseModel.BodyAsJson, ToEncoding(responseModel.Body
 1745            }
 3746            else if (responseModel.BodyFromBase64 != null)
 0747            {
 0748                responseBuilder = responseBuilder.WithBodyFromBase64(responseModel.BodyFromBase64, ToEncoding(responseMo
 0749            }
 3750            else if (responseModel.BodyAsFile != null)
 3751            {
 3752                responseBuilder = responseBuilder.WithBodyFromFile(responseModel.BodyAsFile);
 3753            }
 754
 11755            if (responseModel.UseTransformer)
 0756            {
 0757                responseBuilder = responseBuilder.WithTransformer();
 0758            }
 759
 11760            return responseBuilder;
 11761        }
 762
 763        private ResponseMessage ToJson<T>(T result, bool keepNullValues = false)
 5764        {
 5765            return new ResponseMessage
 5766            {
 5767                Body = JsonConvert.SerializeObject(result, keepNullValues ? _settingsIncludeNullValues : _settings),
 5768                StatusCode = 200,
 5769                Headers = new Dictionary<string, WireMockList<string>> { { HttpKnownHeaderNames.ContentType, new WireMoc
 5770            };
 5771        }
 772
 773        private Encoding ToEncoding(EncodingModel encodingModel)
 8774        {
 8775            return encodingModel != null ? Encoding.GetEncoding(encodingModel.CodePage) : null;
 8776        }
 777
 778        private T DeserializeObject<T>(RequestMessage requestMessage)
 4779        {
 4780            return requestMessage.Body != null ?
 4781                JsonConvert.DeserializeObject<T>(requestMessage.Body) :
 4782                ((JObject)requestMessage.BodyAsJson).ToObject<T>();
 4783        }
 784    }
 785}
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Server\FluentMockServer.Admin.cs' does not exist (any more).

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Server\FluentMockServer.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using JetBrains.Annotations;
 2using System;
 3using System.Collections.Concurrent;
 4using System.Collections.Generic;
 5using System.Linq;
 6using System.Text;
 7using System.Threading;
 8using System.Threading.Tasks;
 9using Newtonsoft.Json;
 10using WireMock.Handlers;
 11using WireMock.Logging;
 12using WireMock.Matchers;
 13using WireMock.Matchers.Request;
 14using WireMock.Owin;
 15using WireMock.RequestBuilders;
 16using WireMock.ResponseProviders;
 17using WireMock.Settings;
 18using WireMock.Util;
 19using WireMock.Validation;
 20
 21namespace WireMock.Server
 22{
 23    /// <summary>
 24    /// The fluent mock server.
 25    /// </summary>
 26    public partial class FluentMockServer : IDisposable
 27    {
 28        private const int ServerStartDelayInMs = 100;
 29
 30        private readonly IWireMockLogger _logger;
 31        private readonly IFileSystemHandler _fileSystemHandler;
 32        private readonly IOwinSelfHost _httpServer;
 4733        private readonly IWireMockMiddlewareOptions _options = new WireMockMiddlewareOptions();
 34
 35        /// <summary>
 36        /// Gets a value indicating whether this server is started.
 37        /// </summary>
 38        [PublicAPI]
 039        public bool IsStarted => _httpServer != null && _httpServer.IsStarted;
 40
 41        /// <summary>
 42        /// Gets the ports.
 43        /// </summary>
 44        [PublicAPI]
 2045        public List<int> Ports { get; }
 46
 47        /// <summary>
 48        /// Gets the urls.
 49        /// </summary>
 50        [PublicAPI]
 6451        public string[] Urls { get; }
 52
 53        /// <summary>
 54        /// Gets the mappings.
 55        /// </summary>
 56        [PublicAPI]
 1857        public IEnumerable<IMapping> Mappings => _options.Mappings.Values.ToArray();
 58
 59        /// <summary>
 60        /// Gets the scenarios.
 61        /// </summary>
 62        [PublicAPI]
 1363        public ConcurrentDictionary<string, ScenarioState> Scenarios => new ConcurrentDictionary<string, ScenarioState>(
 64
 65        #region IDisposable Members
 66        /// <summary>
 67        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
 68        /// </summary>
 69        public void Dispose()
 070        {
 071            Dispose(true);
 072            GC.SuppressFinalize(this);
 073        }
 74
 75        /// <summary>
 76        /// Releases unmanaged and - optionally - managed resources.
 77        /// </summary>
 78        /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release
 79        protected virtual void Dispose(bool disposing)
 080        {
 081            if (_httpServer != null)
 082            {
 083                _httpServer.StopAsync();
 084            }
 085        }
 86        #endregion
 87
 88        #region Start/Stop
 89        /// <summary>
 90        /// Starts the specified settings.
 91        /// </summary>
 92        /// <param name="settings">The FluentMockServerSettings.</param>
 93        /// <returns>The <see cref="FluentMockServer"/>.</returns>
 94        [PublicAPI]
 95        public static FluentMockServer Start(IFluentMockServerSettings settings)
 1696        {
 1697            Check.NotNull(settings, nameof(settings));
 98
 1699            return new FluentMockServer(settings);
 16100        }
 101
 102        /// <summary>
 103        /// Start this FluentMockServer.
 104        /// </summary>
 105        /// <param name="port">The port.</param>
 106        /// <param name="ssl">The SSL support.</param>
 107        /// <returns>The <see cref="FluentMockServer"/>.</returns>
 108        [PublicAPI]
 109        public static FluentMockServer Start([CanBeNull] int? port = 0, bool ssl = false)
 26110        {
 26111            return new FluentMockServer(new FluentMockServerSettings
 26112            {
 26113                Port = port,
 26114                UseSSL = ssl
 26115            });
 25116        }
 117
 118        /// <summary>
 119        /// Start this FluentMockServer.
 120        /// </summary>
 121        /// <param name="urls">The urls to listen on.</param>
 122        /// <returns>The <see cref="FluentMockServer"/>.</returns>
 123        [PublicAPI]
 124        public static FluentMockServer Start(params string[] urls)
 1125        {
 1126            Check.NotNullOrEmpty(urls, nameof(urls));
 127
 1128            return new FluentMockServer(new FluentMockServerSettings
 1129            {
 1130                Urls = urls
 1131            });
 1132        }
 133
 134        /// <summary>
 135        /// Start this FluentMockServer with the admin interface.
 136        /// </summary>
 137        /// <param name="port">The port.</param>
 138        /// <param name="ssl">The SSL support.</param>
 139        /// <returns>The <see cref="FluentMockServer"/>.</returns>
 140        [PublicAPI]
 141        public static FluentMockServer StartWithAdminInterface(int? port = 0, bool ssl = false)
 4142        {
 4143            return new FluentMockServer(new FluentMockServerSettings
 4144            {
 4145                Port = port,
 4146                UseSSL = ssl,
 4147                StartAdminInterface = true
 4148            });
 4149        }
 150
 151        /// <summary>
 152        /// Start this FluentMockServer with the admin interface.
 153        /// </summary>
 154        /// <param name="urls">The urls.</param>
 155        /// <returns>The <see cref="FluentMockServer"/>.</returns>
 156        [PublicAPI]
 157        public static FluentMockServer StartWithAdminInterface(params string[] urls)
 0158        {
 0159            Check.NotNullOrEmpty(urls, nameof(urls));
 160
 0161            return new FluentMockServer(new FluentMockServerSettings
 0162            {
 0163                Urls = urls,
 0164                StartAdminInterface = true
 0165            });
 0166        }
 167
 168        /// <summary>
 169        /// Start this FluentMockServer with the admin interface and read static mappings.
 170        /// </summary>
 171        /// <param name="urls">The urls.</param>
 172        /// <returns>The <see cref="FluentMockServer"/>.</returns>
 173        [PublicAPI]
 174        public static FluentMockServer StartWithAdminInterfaceAndReadStaticMappings(params string[] urls)
 0175        {
 0176            Check.NotNullOrEmpty(urls, nameof(urls));
 177
 0178            return new FluentMockServer(new FluentMockServerSettings
 0179            {
 0180                Urls = urls,
 0181                StartAdminInterface = true,
 0182                ReadStaticMappings = true
 0183            });
 0184        }
 185
 47186        private FluentMockServer(IFluentMockServerSettings settings)
 47187        {
 47188            settings.Logger = settings.Logger ?? new WireMockConsoleLogger();
 189
 47190            _logger = settings.Logger;
 47191            _fileSystemHandler = settings.FileSystemHandler ?? new LocalFileSystemHandler();
 192
 47193            _logger.Info("WireMock.Net by Stef Heyenrath (https://github.com/WireMock-Net/WireMock.Net)");
 47194            _logger.Debug("WireMock.Net server settings {0}", JsonConvert.SerializeObject(settings, Formatting.Indented)
 195
 47196            if (settings.Urls != null)
 1197            {
 1198                Urls = settings.Urls.ToArray();
 1199            }
 200            else
 46201            {
 46202                int port = settings.Port > 0 ? settings.Port.Value : PortUtils.FindFreeTcpPort();
 46203                Urls = new[] { $"{(settings.UseSSL == true ? "https" : "http")}://localhost:{port}" };
 46204            }
 205
 47206            _options.PreWireMockMiddlewareInit = settings.PreWireMockMiddlewareInit;
 47207            _options.PostWireMockMiddlewareInit = settings.PostWireMockMiddlewareInit;
 47208            _options.Logger = _logger;
 209
 210#if USE_ASPNETCORE
 47211            _httpServer = new AspNetCoreSelfHost(_options, Urls);
 212#else
 213            _httpServer = new OwinSelfHost(_options, Urls);
 214#endif
 47215            Ports = _httpServer.Ports;
 216
 47217            _httpServer.StartAsync();
 218
 47219            using (var ctsStartTimeout = new CancellationTokenSource(settings.StartTimeout))
 47220            {
 47221                while (!_httpServer.IsStarted)
 0222                {
 223                    // Throw out exception if service start fails
 0224                    if (_httpServer.RunningException != null)
 0225                    {
 0226                        throw new Exception($"Service start failed with error: {_httpServer.RunningException.Message}", 
 227                    }
 228
 229                    // Respect start timeout setting by throwing TimeoutException
 0230                    if (ctsStartTimeout.IsCancellationRequested)
 0231                    {
 0232                        throw new TimeoutException($"Service start timed out after {TimeSpan.FromMilliseconds(settings.S
 233                    }
 234
 0235                    ctsStartTimeout.Token.WaitHandle.WaitOne(ServerStartDelayInMs);
 0236                }
 47237            }
 238
 47239            if (settings.AllowPartialMapping == true)
 1240            {
 1241                AllowPartialMapping();
 1242            }
 243
 47244            if (settings.StartAdminInterface == true)
 11245            {
 11246                if (!string.IsNullOrEmpty(settings.AdminUsername) && !string.IsNullOrEmpty(settings.AdminPassword))
 1247                {
 1248                    SetBasicAuthentication(settings.AdminUsername, settings.AdminPassword);
 1249                }
 250
 11251                InitAdmin();
 11252            }
 253
 47254            if (settings.ReadStaticMappings == true)
 0255            {
 0256                ReadStaticMappings();
 0257            }
 258
 47259            if (settings.WatchStaticMappings == true)
 0260            {
 0261                WatchStaticMappings();
 0262            }
 263
 47264            if (settings.ProxyAndRecordSettings != null)
 2265            {
 2266                InitProxyAndRecord(settings);
 2267            }
 268
 47269            if (settings.RequestLogExpirationDuration != null)
 1270            {
 1271                SetRequestLogExpirationDuration(settings.RequestLogExpirationDuration);
 1272            }
 273
 47274            if (settings.MaxRequestLogCount != null)
 0275            {
 0276                SetMaxRequestLogCount(settings.MaxRequestLogCount);
 0277            }
 46278        }
 279
 280        /// <summary>
 281        /// Stop this server.
 282        /// </summary>
 283        [PublicAPI]
 284        public void Stop()
 2285        {
 2286            var result = _httpServer?.StopAsync();
 2287            result?.Wait(); // wait for stop to actually happen
 2288        }
 289        #endregion
 290
 291        /// <summary>
 292        /// Adds the catch all mapping.
 293        /// </summary>
 294        [PublicAPI]
 295        public void AddCatchAllMapping()
 0296        {
 0297            Given(Request.Create().WithPath("/*").UsingAnyMethod())
 0298                .WithGuid(Guid.Parse("90008000-0000-4444-a17e-669cd84f1f05"))
 0299                .AtPriority(1000)
 0300                .RespondWith(new DynamicResponseProvider(request => ResponseMessageBuilder.Create("No matching mapping f
 0301        }
 302
 303        /// <summary>
 304        /// Resets LogEntries and Mappings.
 305        /// </summary>
 306        [PublicAPI]
 307        public void Reset()
 0308        {
 0309            ResetLogEntries();
 310
 0311            ResetMappings();
 0312        }
 313
 314        /// <summary>
 315        /// Resets the Mappings.
 316        /// </summary>
 317        [PublicAPI]
 318        public void ResetMappings()
 2319        {
 18320            foreach (var nonAdmin in _options.Mappings.ToArray().Where(m => !m.Value.IsAdminInterface))
 4321            {
 4322                _options.Mappings.TryRemove(nonAdmin.Key, out _);
 4323            }
 2324        }
 325
 326        /// <summary>
 327        /// Deletes the mapping.
 328        /// </summary>
 329        /// <param name="guid">The unique identifier.</param>
 330        [PublicAPI]
 331        public bool DeleteMapping(Guid guid)
 0332        {
 333            // Check a mapping exists with the same GUID, if so, remove it.
 0334            if (_options.Mappings.ContainsKey(guid))
 0335            {
 0336                return _options.Mappings.TryRemove(guid, out _);
 337            }
 338
 0339            return false;
 0340        }
 341
 342        private bool DeleteMapping(string path)
 0343        {
 344            // Check a mapping exists with the same path, if so, remove it.
 0345            var mapping = _options.Mappings.ToArray().FirstOrDefault(entry => string.Equals(entry.Value.Path, path, Stri
 0346            return DeleteMapping(mapping.Key);
 0347        }
 348
 349        /// <summary>
 350        /// The add request processing delay.
 351        /// </summary>
 352        /// <param name="delay">The delay.</param>
 353        [PublicAPI]
 354        public void AddGlobalProcessingDelay(TimeSpan delay)
 1355        {
 1356            _options.RequestProcessingDelay = delay;
 1357        }
 358
 359        /// <summary>
 360        /// Allows the partial mapping.
 361        /// </summary>
 362        [PublicAPI]
 363        public void AllowPartialMapping(bool allow = true)
 1364        {
 1365            _logger.Info("AllowPartialMapping is set to {0}", allow);
 1366            _options.AllowPartialMapping = allow;
 1367        }
 368
 369        /// <summary>
 370        /// Sets the basic authentication.
 371        /// </summary>
 372        /// <param name="username">The username.</param>
 373        /// <param name="password">The password.</param>
 374        [PublicAPI]
 375        public void SetBasicAuthentication([NotNull] string username, [NotNull] string password)
 3376        {
 3377            Check.NotNull(username, nameof(username));
 3378            Check.NotNull(password, nameof(password));
 379
 3380            string authorization = Convert.ToBase64String(Encoding.GetEncoding("ISO-8859-1").GetBytes(username + ":" + p
 3381            _options.AuthorizationMatcher = new RegexMatcher(MatchBehaviour.AcceptOnMatch, "^(?i)BASIC " + authorization
 3382        }
 383
 384        /// <summary>
 385        /// Removes the basic authentication.
 386        /// </summary>
 387        [PublicAPI]
 388        public void RemoveBasicAuthentication()
 1389        {
 1390            _options.AuthorizationMatcher = null;
 1391        }
 392
 393        /// <summary>
 394        /// Sets the maximum RequestLog count.
 395        /// </summary>
 396        /// <param name="maxRequestLogCount">The maximum RequestLog count.</param>
 397        [PublicAPI]
 398        public void SetMaxRequestLogCount([CanBeNull] int? maxRequestLogCount)
 1399        {
 1400            _options.MaxRequestLogCount = maxRequestLogCount;
 1401        }
 402
 403        /// <summary>
 404        /// Sets RequestLog expiration in hours.
 405        /// </summary>
 406        /// <param name="requestLogExpirationDuration">The RequestLog expiration in hours.</param>
 407        [PublicAPI]
 408        public void SetRequestLogExpirationDuration([CanBeNull] int? requestLogExpirationDuration)
 1409        {
 1410            _options.RequestLogExpirationDuration = requestLogExpirationDuration;
 1411        }
 412
 413        /// <summary>
 414        /// Resets the Scenarios.
 415        /// </summary>
 416        [PublicAPI]
 417        public void ResetScenarios()
 0418        {
 0419            _options.Scenarios.Clear();
 0420        }
 421
 422        /// <summary>
 423        /// The given.
 424        /// </summary>
 425        /// <param name="requestMatcher">The request matcher.</param>
 426        /// <returns>The <see cref="IRespondWithAProvider"/>.</returns>
 427        [PublicAPI]
 428        public IRespondWithAProvider Given(IRequestMatcher requestMatcher)
 249429        {
 249430            return new RespondWithAProvider(RegisterMapping, requestMatcher);
 249431        }
 432
 433        private void RegisterMapping(IMapping mapping)
 249434        {
 435            // Check a mapping exists with the same Guid, if so, replace it.
 249436            if (_options.Mappings.ContainsKey(mapping.Guid))
 1437            {
 1438                _options.Mappings[mapping.Guid] = mapping;
 1439            }
 440            else
 248441            {
 248442                _options.Mappings.TryAdd(mapping.Guid, mapping);
 248443            }
 249444        }
 445    }
 446}
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Server\FluentMockServer.cs' does not exist (any more).

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Server\FluentMockServer.LogEntries.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using System.Collections;
 3using System.Collections.Generic;
 4using System.Collections.ObjectModel;
 5using System.Collections.Specialized;
 6using JetBrains.Annotations;
 7using WireMock.Logging;
 8using WireMock.Matchers.Request;
 9using System.Linq;
 10using WireMock.Matchers;
 11
 12namespace WireMock.Server
 13{
 14    public partial class FluentMockServer
 15    {
 16        /// <summary>
 17        /// Occurs when [log entries changed].
 18        /// </summary>
 19        [PublicAPI]
 20        public event NotifyCollectionChangedEventHandler LogEntriesChanged
 21        {
 222            add => _options.LogEntries.CollectionChanged += value;
 023            remove => _options.LogEntries.CollectionChanged -= value;
 24        }
 25
 26        /// <summary>
 27        /// Gets the request logs.
 28        /// </summary>
 29        [PublicAPI]
 1030        public IEnumerable<LogEntry> LogEntries => new ReadOnlyCollection<LogEntry>(_options.LogEntries);
 31
 32        /// <summary>
 33        /// The search log-entries based on matchers.
 34        /// </summary>
 35        /// <param name="matchers">The matchers.</param>
 36        /// <returns>The <see cref="IEnumerable"/>.</returns>
 37        [PublicAPI]
 38        public IEnumerable<LogEntry> FindLogEntries([NotNull] params IRequestMatcher[] matchers)
 039        {
 040            var results = new Dictionary<LogEntry, RequestMatchResult>();
 41
 042            foreach (var log in _options.LogEntries)
 043            {
 044                var requestMatchResult = new RequestMatchResult();
 045                foreach (var matcher in matchers)
 046                {
 047                    matcher.GetMatchingScore(log.RequestMessage, requestMatchResult);
 048                }
 49
 050                if (requestMatchResult.AverageTotalScore > MatchScores.AlmostPerfect)
 051                {
 052                    results.Add(log, requestMatchResult);
 053                }
 054            }
 55
 056            return new ReadOnlyCollection<LogEntry>(results.OrderBy(x => x.Value).Select(x => x.Key).ToList());
 057        }
 58
 59        /// <summary>
 60        /// Resets the LogEntries.
 61        /// </summary>
 62        [PublicAPI]
 63        public void ResetLogEntries()
 164        {
 165            _options.LogEntries.Clear();
 166        }
 67
 68        /// <summary>
 69        /// Deletes a LogEntry.
 70        /// </summary>
 71        /// <param name="guid">The unique identifier.</param>
 72        [PublicAPI]
 73        public bool DeleteLogEntry(Guid guid)
 074        {
 75            // Check a logentry exists with the same GUID, if so, remove it.
 076            var existing = _options.LogEntries.FirstOrDefault(m => m.Guid == guid);
 077            if (existing != null)
 078            {
 079                _options.LogEntries.Remove(existing);
 080                return true;
 81            }
 82
 083            return false;
 084        }
 85    }
 86}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Server\FluentMockServer.LogEntries.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_FluentMockServerSettings.htm b/report/coverlet/WireMock.Net_FluentMockServerSettings.htm index 8a0377d0..f7a56d9d 100644 --- a/report/coverlet/WireMock.Net_FluentMockServerSettings.htm +++ b/report/coverlet/WireMock.Net_FluentMockServerSettings.htm @@ -20,105 +20,14 @@ Covered lines:17 Uncovered lines:0 Coverable lines:17 -Total lines:87 +Total lines:0 Line coverage:100%

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Settings\FluentMockServerSettings.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using JetBrains.Annotations;
 3using Newtonsoft.Json;
 4using WireMock.Handlers;
 5using WireMock.Logging;
 6
 7namespace WireMock.Settings
 8{
 9    /// <summary>
 10    /// FluentMockServerSettings
 11    /// </summary>
 12    public class FluentMockServerSettings : IFluentMockServerSettings
 13    {
 14        /// <inheritdoc cref="IFluentMockServerSettings.Port"/>
 15        [PublicAPI]
 12316        public int? Port { get; set; }
 17
 18        /// <inheritdoc cref="IFluentMockServerSettings.UseSSL"/>
 19        [PublicAPI]
 20        // ReSharper disable once InconsistentNaming
 12321        public bool? UseSSL { get; set; }
 22
 23        /// <inheritdoc cref="IFluentMockServerSettings.StartAdminInterface"/>
 24        [PublicAPI]
 10825        public bool? StartAdminInterface { get; set; }
 26
 27        /// <inheritdoc cref="IFluentMockServerSettings.ReadStaticMappings"/>
 28        [PublicAPI]
 9429        public bool? ReadStaticMappings { get; set; }
 30
 31        /// <inheritdoc cref="IFluentMockServerSettings.WatchStaticMappings"/>
 32        [PublicAPI]
 9433        public bool? WatchStaticMappings { get; set; }
 34
 35        /// <inheritdoc cref="IFluentMockServerSettings.ProxyAndRecordSettings"/>
 36        [PublicAPI]
 10037        public IProxyAndRecordSettings ProxyAndRecordSettings { get; set; }
 38
 39        /// <inheritdoc cref="IFluentMockServerSettings.Urls"/>
 40        [PublicAPI]
 9641        public string[] Urls { get; set; }
 42
 43        /// <inheritdoc cref="IFluentMockServerSettings.StartTimeout"/>
 44        [PublicAPI]
 14145        public int StartTimeout { get; set; } = 10000;
 46
 47        /// <inheritdoc cref="IFluentMockServerSettings.AllowPartialMapping"/>
 48        [PublicAPI]
 9549        public bool? AllowPartialMapping { get; set; }
 50
 51        /// <inheritdoc cref="IFluentMockServerSettings.AdminUsername"/>
 52        [PublicAPI]
 6153        public string AdminUsername { get; set; }
 54
 55        /// <inheritdoc cref="IFluentMockServerSettings.AdminPassword"/>
 56        [PublicAPI]
 5157        public string AdminPassword { get; set; }
 58
 59        /// <inheritdoc cref="IFluentMockServerSettings.RequestLogExpirationDuration"/>
 60        [PublicAPI]
 9661        public int? RequestLogExpirationDuration { get; set; }
 62
 63        /// <inheritdoc cref="IFluentMockServerSettings.MaxRequestLogCount"/>
 64        [PublicAPI]
 9465        public int? MaxRequestLogCount { get; set; }
 66
 67        /// <inheritdoc cref="IFluentMockServerSettings.PreWireMockMiddlewareInit"/>
 68        [PublicAPI]
 69        [JsonIgnore]
 4770        public Action<object> PreWireMockMiddlewareInit { get; set; }
 71
 72        /// <inheritdoc cref="IFluentMockServerSettings.PostWireMockMiddlewareInit"/>
 73        [PublicAPI]
 74        [JsonIgnore]
 4775        public Action<object> PostWireMockMiddlewareInit { get; set; }
 76
 77        /// <inheritdoc cref="IFluentMockServerSettings.Logger"/>
 78        [PublicAPI]
 79        [JsonIgnore]
 19580        public IWireMockLogger Logger { get; set; } = new WireMockNullLogger();
 81
 82        /// <inheritdoc cref="IFluentMockServerSettings.FileSystemHandler"/>
 83        [PublicAPI]
 84        [JsonIgnore]
 9885        public IFileSystemHandler FileSystemHandler { get; set; } = new LocalFileSystemHandler();
 86    }
 87}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Settings\FluentMockServerSettings.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_GlobalExceptionMiddleware.htm b/report/coverlet/WireMock.Net_GlobalExceptionMiddleware.htm index c1a58944..d8c81393 100644 --- a/report/coverlet/WireMock.Net_GlobalExceptionMiddleware.htm +++ b/report/coverlet/WireMock.Net_GlobalExceptionMiddleware.htm @@ -20,7 +20,7 @@ Covered lines:17 Uncovered lines:5 Coverable lines:22 -Total lines:71 +Total lines:0 Line coverage:77.2% Branch coverage:58.3% @@ -36,83 +36,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Owin\GlobalExceptionMiddleware.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using System.Threading.Tasks;
 3using Newtonsoft.Json;
 4#if !USE_ASPNETCORE
 5using Microsoft.Owin;
 6using IContext = Microsoft.Owin.IOwinContext;
 7using OwinMiddleware = Microsoft.Owin.OwinMiddleware;
 8using Next = Microsoft.Owin.OwinMiddleware;
 9#else
 10using OwinMiddleware = System.Object;
 11using IContext = Microsoft.AspNetCore.Http.HttpContext;
 12using Next = Microsoft.AspNetCore.Http.RequestDelegate;
 13#endif
 14using WireMock.Owin.Mappers;
 15using WireMock.Validation;
 16
 17namespace WireMock.Owin
 18{
 19    internal class GlobalExceptionMiddleware : OwinMiddleware
 20    {
 21        private readonly IWireMockMiddlewareOptions _options;
 22        private readonly IOwinResponseMapper _responseMapper;
 23
 24#if !USE_ASPNETCORE
 25        public GlobalExceptionMiddleware(Next next, IWireMockMiddlewareOptions options, IOwinResponseMapper responseMapp
 26        {
 27            Check.NotNull(options, nameof(options));
 28            Check.NotNull(responseMapper, nameof(responseMapper));
 29
 30            _options = options;
 31            _responseMapper = responseMapper;
 32        }
 33#else
 4834        public GlobalExceptionMiddleware(Next next, IWireMockMiddlewareOptions options, IOwinResponseMapper responseMapp
 4835        {
 4836            Check.NotNull(options, nameof(options));
 4837            Check.NotNull(responseMapper, nameof(responseMapper));
 38
 4839            Next = next;
 4840            _options = options;
 4841            _responseMapper = responseMapper;
 4842        }
 43#endif
 44
 45#if USE_ASPNETCORE
 4646        public Next Next { get; }
 47#endif
 48
 49#if !USE_ASPNETCORE
 50        public override Task Invoke(IContext ctx)
 51#else
 52        public Task Invoke(IContext ctx)
 53#endif
 4654        {
 4655            return InvokeInternal(ctx);
 4556        }
 57
 58        private async Task InvokeInternal(IContext ctx)
 4659        {
 60            try
 4661            {
 4662                await Next?.Invoke(ctx);
 4663            }
 064            catch (Exception ex)
 065            {
 066                _options.Logger.Error("HttpStatusCode set to 500 {0}", ex);
 067                await _responseMapper.MapAsync(ResponseMessageBuilder.Create(JsonConvert.SerializeObject(ex), 500), ctx.
 068            }
 4669        }
 70    }
 71}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Owin\GlobalExceptionMiddleware.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_HandleBarsJsonPath.htm b/report/coverlet/WireMock.Net_HandleBarsJsonPath.htm index 44960aa6..e3bd8040 100644 --- a/report/coverlet/WireMock.Net_HandleBarsJsonPath.htm +++ b/report/coverlet/WireMock.Net_HandleBarsJsonPath.htm @@ -20,7 +20,7 @@ Covered lines:44 Uncovered lines:1 Coverable lines:45 -Total lines:73 +Total lines:0 Line coverage:97.7% Branch coverage:71.4% @@ -35,85 +35,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Transformers\HandleBarsJsonPath.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using System.Linq;
 3using HandlebarsDotNet;
 4using Newtonsoft.Json;
 5using Newtonsoft.Json.Linq;
 6using WireMock.Validation;
 7
 8namespace WireMock.Transformers
 9{
 10    internal static class HandleBarsJsonPath
 11    {
 12        public static void Register()
 113        {
 114            Handlebars.RegisterHelper("JsonPath.SelectToken", (writer, context, arguments) =>
 515            {
 516                (JObject valueToProcess, string jsonpath) = ParseArguments(arguments);
 117
 118                try
 519                {
 520                    var result = valueToProcess.SelectToken(jsonpath);
 521                    writer.WriteSafeString(result);
 522                }
 123                catch (JsonException)
 124                {
 125                    // Ignore JsonException
 126                }
 527            });
 28
 129            Handlebars.RegisterHelper("JsonPath.SelectTokens", (writer, options, context, arguments) =>
 430            {
 431                (JObject valueToProcess, string jsonpath) = ParseArguments(arguments);
 132
 133                try
 334                {
 335                    var values = valueToProcess.SelectTokens(jsonpath);
 336                    if (values != null)
 337                    {
 1138                        options.Template(writer, values.ToDictionary(value => value.Path, value => value));
 339                    }
 340                }
 141                catch (JsonException)
 142                {
 143                    // Ignore JsonException
 144                }
 345            });
 146        }
 47
 48        private static (JObject valueToProcess, string jsonpath) ParseArguments(object[] arguments)
 749        {
 1450            Check.Condition(arguments, args => args.Length == 2, nameof(arguments));
 751            Check.NotNull(arguments[0], "arguments[0]");
 652            Check.NotNullOrEmpty(arguments[1] as string, "arguments[1]");
 53
 54            JObject valueToProcess;
 55
 656            switch (arguments[0])
 57            {
 58                case string jsonAsString:
 459                    valueToProcess = JObject.Parse(jsonAsString);
 460                    break;
 61
 62                case JObject jsonAsJObject:
 263                    valueToProcess = jsonAsJObject;
 264                    break;
 65
 66                default:
 067                    throw new NotSupportedException($"The value '{arguments[0]}' with type '{arguments[0]?.GetType()}' c
 68            }
 69
 670            return (valueToProcess, (string) arguments[1]);
 671        }
 72    }
 73}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Transformers\HandleBarsJsonPath.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_HandleBarsLinq.htm b/report/coverlet/WireMock.Net_HandleBarsLinq.htm index 222d255f..ecfe2eed 100644 --- a/report/coverlet/WireMock.Net_HandleBarsLinq.htm +++ b/report/coverlet/WireMock.Net_HandleBarsLinq.htm @@ -20,7 +20,7 @@ Covered lines:48 Uncovered lines:0 Coverable lines:48 -Total lines:86 +Total lines:0 Line coverage:100% Branch coverage:92.8% @@ -36,98 +36,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Transformers\HandleBarsLinq.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using System.Linq;
 3using System.Linq.Dynamic.Core;
 4using System.Linq.Dynamic.Core.Exceptions;
 5using HandlebarsDotNet;
 6using Newtonsoft.Json.Linq;
 7using WireMock.Util;
 8using WireMock.Validation;
 9
 10namespace WireMock.Transformers
 11{
 12    internal static class HandleBarsLinq
 13    {
 14        public static void Register()
 115        {
 116            Handlebars.RegisterHelper("Linq", (writer, context, arguments) =>
 817            {
 818                (JToken valueToProcess, string linqStatement) = ParseArguments(arguments);
 119
 120                try
 521                {
 522                    object result = ExecuteDynamicLinq(valueToProcess, linqStatement);
 423                    writer.WriteSafeString(result);
 424                }
 225                catch (ParseException)
 226                {
 127                    // Ignore ParseException
 228                }
 529            });
 30
 131            Handlebars.RegisterHelper("Linq", (writer, options, context, arguments) =>
 332            {
 333                (JToken valueToProcess, string linqStatement) = ParseArguments(arguments);
 134
 135                try
 336                {
 337                    var result = ExecuteDynamicLinq(valueToProcess, linqStatement);
 238                    options.Template(writer, result);
 239                }
 240                catch (ParseException)
 241                {
 142                    // Ignore ParseException
 243                }
 344            });
 145        }
 46
 47        private static dynamic ExecuteDynamicLinq(JToken value, string linqStatement)
 648        {
 49            // Convert a single object to a Queryable JObject-list with 1 entry.
 650            var queryable1 = new[] { value }.AsQueryable();
 51
 52            // Generate the DynamicLinq select statement.
 653            string dynamicSelect = JsonUtils.GenerateDynamicLinqStatement(value);
 54
 55            // Execute DynamicLinq Select statement.
 656            var queryable2 = queryable1.Select(dynamicSelect);
 57
 58            // Execute the Select(...) method and get first result with FirstOrDefault().
 659            return queryable2.Select(linqStatement).FirstOrDefault();
 460        }
 61
 62        private static (JToken valueToProcess, string linqStatement) ParseArguments(object[] arguments)
 963        {
 1864            Check.Condition(arguments, args => args.Length == 2, nameof(arguments));
 865            Check.NotNull(arguments[0], "arguments[0]");
 766            Check.NotNullOrEmpty(arguments[1] as string, "arguments[1]");
 67
 68            JToken valueToProcess;
 769            switch (arguments[0])
 70            {
 71                case string jsonAsString:
 172                    valueToProcess = new JValue(jsonAsString);
 173                    break;
 74
 75                case JToken jsonAsJObject:
 576                    valueToProcess = jsonAsJObject;
 577                    break;
 78
 79                default:
 180                    throw new NotSupportedException($"The value '{arguments[0]}' with type '{arguments[0]?.GetType()}' c
 81            }
 82
 683            return (valueToProcess, (string) arguments[1]);
 684        }
 85    }
 86}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Transformers\HandleBarsLinq.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_HandleBarsRegex.htm b/report/coverlet/WireMock.Net_HandleBarsRegex.htm index 098c10f5..15e1487c 100644 --- a/report/coverlet/WireMock.Net_HandleBarsRegex.htm +++ b/report/coverlet/WireMock.Net_HandleBarsRegex.htm @@ -20,7 +20,7 @@ Covered lines:43 Uncovered lines:0 Coverable lines:43 -Total lines:66 +Total lines:0 Line coverage:100% Branch coverage:91.6% @@ -35,78 +35,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Transformers\HandleBarsRegex.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using System.Linq;
 3using System.Text.RegularExpressions;
 4using HandlebarsDotNet;
 5using WireMock.Util;
 6using WireMock.Validation;
 7
 8namespace WireMock.Transformers
 9{
 10    internal static class HandleBarsRegex
 11    {
 12        public static void Register()
 113        {
 114            Handlebars.RegisterHelper("Regex.Match", (writer, context, arguments) =>
 415            {
 416                (string stringToProcess, string regexPattern, object defaultValue) = ParseArguments(arguments);
 117
 418                Match match = Regex.Match(stringToProcess, regexPattern);
 119
 420                if (match.Success)
 221                {
 222                    writer.WriteSafeString(match.Value);
 223                }
 324                else if (defaultValue != null)
 225                {
 226                    writer.WriteSafeString(defaultValue);
 227                }
 428            });
 29
 130            Handlebars.RegisterHelper("Regex.Match", (writer, options, context, arguments) =>
 531            {
 532                (string stringToProcess, string regexPattern, object defaultValue) = ParseArguments(arguments);
 133
 434                var regex = new Regex(regexPattern);
 435                var namedGroups = RegexUtils.GetNamedGroups(regex, stringToProcess);
 436                if (namedGroups.Any())
 237                {
 238                    options.Template(writer, namedGroups);
 239                }
 340                else if (defaultValue != null)
 241                {
 242                    options.Template(writer, defaultValue);
 243                }
 444            });
 145        }
 46
 47        private static (string stringToProcess, string regexPattern, object defaultValue) ParseArguments(object[] argume
 748        {
 1449            Check.Condition(arguments, args => args.Length == 2 || args.Length == 3, nameof(arguments));
 50
 51            string ParseAsString(object arg)
 1352            {
 1353                if (arg is string)
 1254                {
 1255                    return (string) arg;
 56                }
 57                else
 158                {
 159                    throw new NotSupportedException($"The value '{arg}' with type '{arg?.GetType()}' cannot be used in H
 60                }
 1261            }
 62
 763            return (ParseAsString(arguments[0]), ParseAsString(arguments[1]), arguments.Length == 3 ? arguments[2] : nul
 664        }
 65    }
 66}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Transformers\HandleBarsRegex.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_HandlebarsHelpers.htm b/report/coverlet/WireMock.Net_HandlebarsHelpers.htm index 33fd3a31..9818cc8f 100644 --- a/report/coverlet/WireMock.Net_HandlebarsHelpers.htm +++ b/report/coverlet/WireMock.Net_HandlebarsHelpers.htm @@ -20,7 +20,7 @@ Covered lines:5 Uncovered lines:0 Coverable lines:5 -Total lines:14 +Total lines:0 Line coverage:100% @@ -33,26 +33,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Transformers\HandleBarsHelpers.cs

- - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1namespace WireMock.Transformers
 2{
 3    internal static class HandlebarsHelpers
 4    {
 5        public static void Register()
 16        {
 17            HandleBarsRegex.Register();
 8
 19            HandleBarsJsonPath.Register();
 10
 111            HandleBarsLinq.Register();
 112        }
 13    }
 14}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Transformers\HandleBarsHelpers.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_HeaderModel.htm b/report/coverlet/WireMock.Net_HeaderModel.htm index ab43cb3a..04b1aa56 100644 --- a/report/coverlet/WireMock.Net_HeaderModel.htm +++ b/report/coverlet/WireMock.Net_HeaderModel.htm @@ -20,38 +20,14 @@ Covered lines:0 Uncovered lines:2 Coverable lines:2 -Total lines:20 +Total lines:0 Line coverage:0%

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Admin\Mappings\HeaderModel.cs

- - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System.Collections.Generic;
 2
 3namespace WireMock.Admin.Mappings
 4{
 5    /// <summary>
 6    /// Header Model
 7    /// </summary>
 8    public class HeaderModel
 9    {
 10        /// <summary>
 11        /// Gets or sets the name.
 12        /// </summary>
 013        public string Name { get; set; }
 14
 15        /// <summary>
 16        /// Gets or sets the matchers.
 17        /// </summary>
 018        public IList<MatcherModel> Matchers { get; set; }
 19    }
 20}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Admin\Mappings\HeaderModel.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_HttpClientHelper.htm b/report/coverlet/WireMock.Net_HttpClientHelper.htm index 778a8b28..e0c45f7f 100644 --- a/report/coverlet/WireMock.Net_HttpClientHelper.htm +++ b/report/coverlet/WireMock.Net_HttpClientHelper.htm @@ -20,7 +20,7 @@ Covered lines:14 Uncovered lines:14 Coverable lines:28 -Total lines:78 +Total lines:0 Line coverage:50% Branch coverage:30% @@ -35,90 +35,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Http\HttpClientHelper.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using System.Net;
 3using System.Net.Http;
 4using System.Threading.Tasks;
 5using JetBrains.Annotations;
 6using WireMock.HttpsCertificate;
 7using WireMock.Validation;
 8
 9namespace WireMock.Http
 10{
 11    internal static class HttpClientHelper
 12    {
 13        public static HttpClient CreateHttpClient(string clientX509Certificate2ThumbprintOrSubjectName = null)
 214        {
 15#if NETSTANDARD
 216            var handler = new HttpClientHandler
 217            {
 218                CheckCertificateRevocationList = false,
 219                SslProtocols = System.Security.Authentication.SslProtocols.Tls12 | System.Security.Authentication.SslPro
 220                ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => true,
 221                AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
 222            };
 23#elif NET46
 24            var handler = new HttpClientHandler
 25            {
 26                ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => true,
 27                AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
 28            };
 29            ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11;
 30#else
 31            var handler = new WebRequestHandler
 32            {
 33                ServerCertificateValidationCallback = (sender, certificate, chain, errors) => true,
 34                AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
 35            };
 36            ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11;
 37#endif
 38
 239            if (!string.IsNullOrEmpty(clientX509Certificate2ThumbprintOrSubjectName))
 040            {
 041                handler.ClientCertificateOptions = ClientCertificateOption.Manual;
 42
 043                var x509Certificate2 = ClientCertificateHelper.GetCertificate(clientX509Certificate2ThumbprintOrSubjectN
 044                handler.ClientCertificates.Add(x509Certificate2);
 045            }
 46
 47            // For proxy we shouldn't follow auto redirects
 248            handler.AllowAutoRedirect = false;
 49
 50            // If UseCookies enabled, httpClient ignores Cookie header
 251            handler.UseCookies = false;
 52
 253            var client = new HttpClient(handler);
 54#if NET452 || NET46
 55            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityPro
 56#endif
 257            return client;
 258        }
 59
 60        public static async Task<ResponseMessage> SendAsync([NotNull] HttpClient client, [NotNull] RequestMessage reques
 061        {
 062            Check.NotNull(client, nameof(client));
 063            Check.NotNull(requestMessage, nameof(requestMessage));
 64
 065            var originalUri = new Uri(requestMessage.Url);
 066            var requiredUri = new Uri(url);
 67
 68            // Create HttpRequestMessage
 069            var httpRequestMessage = HttpRequestMessageHelper.Create(requestMessage, url);
 70
 71            // Call the URL
 072            var httpResponseMessage = await client.SendAsync(httpRequestMessage, HttpCompletionOption.ResponseContentRea
 73
 74            // Create ResponseMessage
 075            return await HttpResponseMessageHelper.Create(httpResponseMessage, requiredUri, originalUri);
 076        }
 77    }
 78}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Http\HttpClientHelper.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_HttpRequestMessageHelper.htm b/report/coverlet/WireMock.Net_HttpRequestMessageHelper.htm index a15853a4..1fea1e47 100644 --- a/report/coverlet/WireMock.Net_HttpRequestMessageHelper.htm +++ b/report/coverlet/WireMock.Net_HttpRequestMessageHelper.htm @@ -20,7 +20,7 @@ Covered lines:50 Uncovered lines:5 Coverable lines:55 -Total lines:86 +Total lines:0 Line coverage:90.9% Branch coverage:94.4% @@ -34,98 +34,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Http\HttpRequestMessageHelper.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using System.Linq;
 4using System.Net.Http;
 5using System.Text;
 6using MimeKit;
 7using Newtonsoft.Json;
 8
 9namespace WireMock.Http
 10{
 11    internal static class HttpRequestMessageHelper
 12    {
 13        public static HttpRequestMessage Create(RequestMessage requestMessage, string url)
 714        {
 715            var httpRequestMessage = new HttpRequestMessage(new HttpMethod(requestMessage.Method), url);
 16
 717            ContentType contentType = null;
 718            if (requestMessage.Headers != null && requestMessage.Headers.ContainsKey(HttpKnownHeaderNames.ContentType))
 419            {
 420                var value = requestMessage.Headers[HttpKnownHeaderNames.ContentType].FirstOrDefault();
 421                ContentType.TryParse(value, out contentType);
 422            }
 23
 24            // Set Body if present
 725            if (requestMessage.BodyAsBytes != null)
 126            {
 127                httpRequestMessage.Content = new ByteArrayContent(requestMessage.BodyAsBytes);
 128            }
 629            else if (requestMessage.BodyAsJson != null)
 230            {
 231                if (contentType != null)
 132                {
 133                    var encoding = requestMessage.BodyEncoding ?? Encoding.GetEncoding(contentType.Charset ?? "UTF-8");
 134                    httpRequestMessage.Content = new StringContent(JsonConvert.SerializeObject(requestMessage.BodyAsJson
 135                }
 36                else
 137                {
 138                    httpRequestMessage.Content = new StringContent(JsonConvert.SerializeObject(requestMessage.BodyAsJson
 139                }
 240            }
 441            else if (requestMessage.Body != null)
 442            {
 443                if (contentType != null)
 344                {
 345                    var encoding = requestMessage.BodyEncoding ?? Encoding.GetEncoding(contentType.Charset ?? "UTF-8");
 346                    httpRequestMessage.Content = new StringContent(requestMessage.Body, encoding, contentType.MimeType);
 347                }
 48                else
 149                {
 150                    httpRequestMessage.Content = new StringContent(requestMessage.Body, requestMessage.BodyEncoding);
 151                }
 452            }
 53
 54            // Overwrite the host header
 755            httpRequestMessage.Headers.Host = new Uri(url).Authority;
 56
 57            // Set other headers if present and if not excluded
 758            if (requestMessage.Headers == null || requestMessage.Headers.Count == 0)
 259            {
 260                return httpRequestMessage;
 61            }
 62
 563            var excludeHeaders = new List<string> { HttpKnownHeaderNames.Host, HttpKnownHeaderNames.ContentLength };
 564            if (contentType != null)
 465            {
 466                excludeHeaders.Add(HttpKnownHeaderNames.ContentType);
 467            }
 68
 2269            foreach (var header in requestMessage.Headers.Where(h => !excludeHeaders.Contains(h.Key, StringComparer.Ordi
 170            {
 71                // Try to add to request headers. If failed - try to add to content headers
 172                if (httpRequestMessage.Headers.Contains(header.Key))
 073                {
 074                    continue;
 75                }
 76
 177                if (!httpRequestMessage.Headers.TryAddWithoutValidation(header.Key, header.Value))
 078                {
 079                    httpRequestMessage.Content.Headers.TryAddWithoutValidation(header.Key, header.Value);
 080                }
 181            }
 82
 583            return httpRequestMessage;
 784        }
 85    }
 86}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Http\HttpRequestMessageHelper.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_JsonMatcher.htm b/report/coverlet/WireMock.Net_JsonMatcher.htm index 6adb8c3f..eb91e363 100644 --- a/report/coverlet/WireMock.Net_JsonMatcher.htm +++ b/report/coverlet/WireMock.Net_JsonMatcher.htm @@ -20,7 +20,7 @@ Covered lines:37 Uncovered lines:5 Coverable lines:42 -Total lines:105 +Total lines:0 Line coverage:88% Branch coverage:83.3% @@ -38,117 +38,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\JsonMatcher.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using JetBrains.Annotations;
 2using Newtonsoft.Json;
 3using Newtonsoft.Json.Linq;
 4using WireMock.Validation;
 5
 6namespace WireMock.Matchers
 7{
 8    /// <summary>
 9    /// JsonMatcher
 10    /// </summary>
 11    public class JsonMatcher : IValueMatcher
 12    {
 13        /// <inheritdoc cref="IValueMatcher.Value"/>
 714        public object Value { get; }
 15
 16        /// <inheritdoc cref="IMatcher.Name"/>
 117        public string Name => "JsonMatcher";
 18
 19        /// <inheritdoc cref="IMatcher.MatchBehaviour"/>
 720        public MatchBehaviour MatchBehaviour { get; }
 21
 22        /// <summary>
 23        /// Initializes a new instance of the <see cref="JsonMatcher"/> class.
 24        /// </summary>
 25        /// <param name="value">The string value to check for equality.</param>
 626        public JsonMatcher([NotNull] string value) : this(MatchBehaviour.AcceptOnMatch, value)
 627        {
 628        }
 29
 30        /// <summary>
 31        /// Initializes a new instance of the <see cref="JsonMatcher"/> class.
 32        /// </summary>
 33        /// <param name="value">The object value to check for equality.</param>
 234        public JsonMatcher([NotNull] object value) : this(MatchBehaviour.AcceptOnMatch, value)
 235        {
 236        }
 37
 38        /// <summary>
 39        /// Initializes a new instance of the <see cref="JsonMatcher"/> class.
 40        /// </summary>
 41        /// <param name="matchBehaviour">The match behaviour.</param>
 42        /// <param name="value">The string value to check for equality.</param>
 743        public JsonMatcher(MatchBehaviour matchBehaviour, [NotNull] string value)
 744        {
 745            Check.NotNull(value, nameof(value));
 46
 747            MatchBehaviour = matchBehaviour;
 748            Value = value;
 749        }
 50
 51        /// <summary>
 52        /// Initializes a new instance of the <see cref="JsonMatcher"/> class.
 53        /// </summary>
 54        /// <param name="matchBehaviour">The match behaviour.</param>
 55        /// <param name="value">The object value to check for equality.</param>
 256        public JsonMatcher(MatchBehaviour matchBehaviour, [NotNull] object value)
 257        {
 258            Check.NotNull(value, nameof(value));
 59
 260            MatchBehaviour = matchBehaviour;
 261            Value = value;
 262        }
 63
 64        /// <inheritdoc cref="IObjectMatcher.IsMatch"/>
 65        public double IsMatch(object input)
 766        {
 767            bool match = false;
 68
 69            // When input is null or byte[], return Mismatch.
 770            if (input != null && !(input is byte[]))
 471            {
 72                try
 473                {
 74                    // Check if JToken or object
 475                    JToken jtokenInput = input is JToken tokenInput ? tokenInput : JObject.FromObject(input);
 76
 77                    // Check if JToken or string or object
 78                    JToken jtokenValue;
 479                    switch (Value)
 80                    {
 81                        case JToken tokenValue:
 082                            jtokenValue = tokenValue;
 083                            break;
 84
 85                        case string stringValue:
 286                            jtokenValue = JToken.Parse(stringValue);
 287                            break;
 88
 89                        default:
 290                            jtokenValue = JObject.FromObject(Value);
 291                            break;
 92                    }
 93
 494                    match = JToken.DeepEquals(jtokenValue, jtokenInput);
 495                }
 096                catch (JsonException)
 097                {
 98                    // just ignore JsonException
 099                }
 4100            }
 101
 7102            return MatchBehaviourHelper.Convert(MatchBehaviour, MatchScores.ToScore(match));
 7103        }
 104    }
 105}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\JsonMatcher.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_JsonPathMatcher.htm b/report/coverlet/WireMock.Net_JsonPathMatcher.htm index ce9fa071..f0e06427 100644 --- a/report/coverlet/WireMock.Net_JsonPathMatcher.htm +++ b/report/coverlet/WireMock.Net_JsonPathMatcher.htm @@ -20,7 +20,7 @@ Covered lines:43 Uncovered lines:3 Coverable lines:46 -Total lines:102 +Total lines:0 Line coverage:93.4% Branch coverage:90% @@ -39,114 +39,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\JSONPathMatcher.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System.Linq;
 2using JetBrains.Annotations;
 3using Newtonsoft.Json;
 4using Newtonsoft.Json.Linq;
 5using WireMock.Validation;
 6
 7namespace WireMock.Matchers
 8{
 9    /// <summary>
 10    /// JsonPathMatcher
 11    /// </summary>
 12    /// <seealso cref="IMatcher" />
 13    /// <seealso cref="IObjectMatcher" />
 14    public class JsonPathMatcher : IStringMatcher, IObjectMatcher
 15    {
 16        private readonly string[] _patterns;
 17
 18        /// <inheritdoc cref="IMatcher.MatchBehaviour"/>
 1419        public MatchBehaviour MatchBehaviour { get; }
 20
 21        /// <summary>
 22        /// Initializes a new instance of the <see cref="JsonPathMatcher"/> class.
 23        /// </summary>
 24        /// <param name="patterns">The patterns.</param>
 1525        public JsonPathMatcher([NotNull] params string[] patterns) : this(MatchBehaviour.AcceptOnMatch, patterns)
 1526        {
 1527        }
 28
 29        /// <summary>
 30        /// Initializes a new instance of the <see cref="JsonPathMatcher"/> class.
 31        /// </summary>
 32        /// <param name="matchBehaviour">The match behaviour.</param>
 33        /// <param name="patterns">The patterns.</param>
 1634        public JsonPathMatcher(MatchBehaviour matchBehaviour, [NotNull] params string[] patterns)
 1635        {
 1636            Check.NotNull(patterns, nameof(patterns));
 37
 1638            MatchBehaviour = matchBehaviour;
 1639            _patterns = patterns;
 1640        }
 41
 42        /// <inheritdoc cref="IStringMatcher.IsMatch"/>
 43        public double IsMatch(string input)
 544        {
 545            double match = MatchScores.Mismatch;
 546            if (input != null)
 447            {
 48                try
 449                {
 450                    var jtoken = JToken.Parse(input);
 251                    match = IsMatch(jtoken);
 252                }
 253                catch (JsonException)
 254                {
 55                    // just ignore JsonException
 256                }
 457            }
 58
 559            return MatchBehaviourHelper.Convert(MatchBehaviour, match);
 560        }
 61
 62        /// <inheritdoc cref="IObjectMatcher.IsMatch"/>
 63        public double IsMatch(object input)
 964        {
 965            double match = MatchScores.Mismatch;
 66
 67            // When input is null or byte[], return Mismatch.
 968            if (input != null && !(input is byte[]))
 769            {
 70                try
 771                {
 72                    // Check if JToken or object
 773                    JToken jtoken = input is JToken token ? token : JObject.FromObject(input);
 774                    match = IsMatch(jtoken);
 775                }
 076                catch (JsonException)
 077                {
 78                    // just ignore JsonException
 079                }
 780            }
 81
 982            return MatchBehaviourHelper.Convert(MatchBehaviour, match);
 983        }
 84
 85        /// <inheritdoc cref="IStringMatcher.GetPatterns"/>
 86        public string[] GetPatterns()
 187        {
 188            return _patterns;
 189        }
 90
 91        /// <inheritdoc cref="IMatcher.Name"/>
 192        public string Name => "JsonPathMatcher";
 93
 94        private double IsMatch(JToken jtoken)
 995        {
 96            // Wrap in array if needed
 997            JToken tokenOrArray = jtoken is JArray ? jtoken : new JArray(jtoken);
 98
 2799            return MatchScores.ToScore(_patterns.Select(pattern => tokenOrArray.SelectToken(pattern) != null));
 9100        }
 101    }
 102}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\JSONPathMatcher.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_JsonUtils.htm b/report/coverlet/WireMock.Net_JsonUtils.htm index 7723f6fa..dc981e4f 100644 --- a/report/coverlet/WireMock.Net_JsonUtils.htm +++ b/report/coverlet/WireMock.Net_JsonUtils.htm @@ -20,7 +20,7 @@ Covered lines:84 Uncovered lines:0 Coverable lines:84 -Total lines:147 +Total lines:0 Line coverage:100% Branch coverage:100% @@ -39,159 +39,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Util\JsonUtils.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using Newtonsoft.Json.Linq;
 2using System;
 3using System.Collections.Generic;
 4using System.Linq;
 5using System.Text;
 6
 7namespace WireMock.Util
 8{
 9    internal static class JsonUtils
 10    {
 11        public static T ParseJTokenToObject<T>(object value)
 1112        {
 1113            switch (value)
 14            {
 15                case JToken tokenValue:
 1016                    return tokenValue.ToObject<T>();
 17
 18                default:
 119                    return default(T);
 20            }
 1121        }
 22
 23        public static string GenerateDynamicLinqStatement(JToken jsonObject)
 1124        {
 1125            var lines = new List<string>();
 1126            WalkNode(jsonObject, null, null, lines);
 27
 1028            return lines.First();
 1029        }
 30
 31        private static void WalkNode(JToken node, string path, string propertyName, List<string> lines)
 4132        {
 4133            if (node.Type == JTokenType.Object)
 1034            {
 1035                ProcessObject(node, propertyName, lines);
 936            }
 3137            else if (node.Type == JTokenType.Array)
 138            {
 139                ProcessArray(node, propertyName, lines);
 140            }
 41            else
 3042            {
 3043                ProcessItem(node, path ?? "it", propertyName, lines);
 2944            }
 3945        }
 46
 47        private static void ProcessObject(JToken node, string propertyName, List<string> lines)
 1048        {
 1049            var items = new List<string>();
 1050            var text = new StringBuilder("new (");
 51
 52            // In case of Object, loop all children. Do a ToArray() to avoid `Collection was modified` exceptions.
 8553            foreach (JProperty child in node.Children<JProperty>().ToArray())
 2854            {
 2855                WalkNode(child.Value, child.Path, child.Name, items);
 2756            }
 57
 958            text.Append(string.Join(", ", items));
 959            text.Append(")");
 60
 961            if (!string.IsNullOrEmpty(propertyName))
 162            {
 163                text.AppendFormat(" as {0}", propertyName);
 164            }
 65
 966            lines.Add(text.ToString());
 967        }
 68
 69        private static void ProcessArray(JToken node, string propertyName, List<string> lines)
 170        {
 171            var items = new List<string>();
 172            var text = new StringBuilder("(new [] { ");
 73
 74            // In case of Array, loop all items. Do a ToArray() to avoid `Collection was modified` exceptions.
 175            int idx = 0;
 776            foreach (JToken child in node.Children().ToArray())
 277            {
 278                WalkNode(child, $"{node.Path}[{idx}]", null, items);
 279                idx++;
 280            }
 81
 182            text.Append(string.Join(", ", items));
 183            text.Append("})");
 84
 185            if (!string.IsNullOrEmpty(propertyName))
 186            {
 187                text.AppendFormat(" as {0}", propertyName);
 188            }
 89
 190            lines.Add(text.ToString());
 191        }
 92
 93        private static void ProcessItem(JToken node, string path, string propertyName, List<string> lines)
 3094        {
 3095            string castText = string.Empty;
 3096            switch (node.Type)
 97            {
 98                case JTokenType.Boolean:
 199                    castText = $"bool({path})";
 1100                    break;
 101
 102                case JTokenType.Date:
 1103                    castText = $"DateTime({path})";
 1104                    break;
 105
 106                case JTokenType.Float:
 2107                    castText = $"double({path})";
 2108                    break;
 109
 110                case JTokenType.Guid:
 1111                    castText = $"Guid({path})";
 1112                    break;
 113
 114                case JTokenType.Integer:
 11115                    castText = $"int({path})";
 11116                    break;
 117
 118                case JTokenType.Null:
 1119                    castText = "null";
 1120                    break;
 121
 122                case JTokenType.String:
 10123                    castText = $"string({path})";
 10124                    break;
 125
 126                case JTokenType.TimeSpan:
 1127                    castText = $"TimeSpan({path})";
 1128                    break;
 129
 130                case JTokenType.Uri:
 1131                    castText = $"Uri({path})";
 1132                    break;
 133
 134                default:
 1135                    throw new NotSupportedException(
 1136                        $"JTokenType '{node.Type}' cannot be converted to a Dynamic Linq cast operator.");
 137            }
 138
 29139            if (!string.IsNullOrEmpty(propertyName))
 25140            {
 25141                castText += $" as {propertyName}";
 25142            }
 143
 29144            lines.Add(castText);
 29145        }
 146    }
 147}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Util\JsonUtils.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_LinqMatcher.htm b/report/coverlet/WireMock.Net_LinqMatcher.htm index 5bf121d3..803edfe7 100644 --- a/report/coverlet/WireMock.Net_LinqMatcher.htm +++ b/report/coverlet/WireMock.Net_LinqMatcher.htm @@ -20,7 +20,7 @@ Covered lines:36 Uncovered lines:0 Coverable lines:36 -Total lines:107 +Total lines:0 Line coverage:100% Branch coverage:100% @@ -40,119 +40,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\LinqMatcher.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System.Linq;
 2using System.Linq.Dynamic.Core;
 3using JetBrains.Annotations;
 4using Newtonsoft.Json.Linq;
 5using WireMock.Util;
 6
 7namespace WireMock.Matchers
 8{
 9    /// <summary>
 10    /// System.Linq.Dynamic.Core Expression Matcher
 11    /// </summary>
 12    /// <inheritdoc cref="IStringMatcher"/>
 13    public class LinqMatcher : IStringMatcher
 14    {
 15        private readonly string[] _patterns;
 16
 17        /// <inheritdoc cref="IMatcher.MatchBehaviour"/>
 818        public MatchBehaviour MatchBehaviour { get; }
 19
 20        /// <summary>
 21        /// Initializes a new instance of the <see cref="LinqMatcher"/> class.
 22        /// </summary>
 23        /// <param name="pattern">The pattern.</param>
 624        public LinqMatcher([NotNull] string pattern) : this(new[] { pattern })
 625        {
 626        }
 27
 28        /// <summary>
 29        /// Initializes a new instance of the <see cref="LinqMatcher"/> class.
 30        /// </summary>
 31        /// <param name="patterns">The patterns.</param>
 632        public LinqMatcher([NotNull] string[] patterns) : this(MatchBehaviour.AcceptOnMatch, patterns)
 633        {
 634        }
 35
 36        /// <summary>
 37        /// Initializes a new instance of the <see cref="LinqMatcher"/> class.
 38        /// </summary>
 39        /// <param name="matchBehaviour">The match behaviour.</param>
 40        /// <param name="pattern">The pattern.</param>
 241        public LinqMatcher(MatchBehaviour matchBehaviour, [NotNull] string pattern) : this(matchBehaviour, new[] { patte
 242        {
 243        }
 44
 45        /// <summary>
 46        /// Initializes a new instance of the <see cref="LinqMatcher"/> class.
 47        /// </summary>
 48        /// <param name="matchBehaviour">The match behaviour.</param>
 49        /// <param name="patterns">The patterns.</param>
 1050        public LinqMatcher(MatchBehaviour matchBehaviour, [NotNull] string[] patterns)
 1051        {
 1052            MatchBehaviour = matchBehaviour;
 1053            _patterns = patterns;
 1054        }
 55
 56        /// <inheritdoc cref="IStringMatcher.IsMatch"/>
 57        public double IsMatch(string input)
 358        {
 59            // Convert a single input string to a Queryable string-list with 1 entry.
 360            IQueryable queryable = new[] { input }.AsQueryable();
 61
 62            // Use the Any(...) method to check if the result matches
 963            double match = MatchScores.ToScore(_patterns.Select(pattern => queryable.Any(pattern)));
 64
 365            return MatchBehaviourHelper.Convert(MatchBehaviour, match);
 366        }
 67
 68        /// <inheritdoc cref="IObjectMatcher.IsMatch"/>
 69        public double IsMatch(object input)
 270        {
 71            JObject value;
 272            switch (input)
 73            {
 74                case JObject valueAsJObject:
 175                    value = valueAsJObject;
 176                    break;
 77
 78                default:
 179                    value = JObject.FromObject(input);
 180                    break;
 81            }
 82
 83            // Convert a single object to a Queryable JObject-list with 1 entry.
 284            var queryable1 = new[] { value }.AsQueryable();
 85
 86            // Generate the DynamicLinq select statement.
 287            string dynamicSelect = JsonUtils.GenerateDynamicLinqStatement(value);
 88
 89            // Execute DynamicLinq Select statement.
 290            var queryable2 = queryable1.Select(dynamicSelect);
 91
 92            // Use the Any(...) method to check if the result matches.
 693            double match = MatchScores.ToScore(_patterns.Select(pattern => queryable2.Any(pattern)));
 94
 295            return MatchBehaviourHelper.Convert(MatchBehaviour, match);
 296        }
 97
 98        /// <inheritdoc cref="IStringMatcher.GetPatterns"/>
 99        public string[] GetPatterns()
 4100        {
 4101            return _patterns;
 4102        }
 103
 104        /// <inheritdoc cref="IMatcher.Name"/>
 2105        public string Name => "LinqMatcher";
 106    }
 107}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\LinqMatcher.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_LocalFileSystemHandler.htm b/report/coverlet/WireMock.Net_LocalFileSystemHandler.htm index 9897aea8..a5179c18 100644 --- a/report/coverlet/WireMock.Net_LocalFileSystemHandler.htm +++ b/report/coverlet/WireMock.Net_LocalFileSystemHandler.htm @@ -20,7 +20,7 @@ Covered lines:20 Uncovered lines:5 Coverable lines:25 -Total lines:62 +Total lines:0 Line coverage:80% @@ -39,74 +39,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Handlers\LocalFileSystemHandler.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System.Collections.Generic;
 2using System.IO;
 3using JetBrains.Annotations;
 4using WireMock.Validation;
 5
 6namespace WireMock.Handlers
 7{
 8    /// <summary>
 9    /// Default implementation for a handler to interact with the local file system to read and write static mapping fil
 10    /// </summary>
 11    public class LocalFileSystemHandler : IFileSystemHandler
 12    {
 113        private static readonly string AdminMappingsFolder = Path.Combine("__admin", "mappings");
 14
 15        /// <inheritdoc cref="IFileSystemHandler.FolderExists"/>
 16        public bool FolderExists([NotNull] string path)
 317        {
 318            Check.NotNullOrEmpty(path, nameof(path));
 19
 320            return Directory.Exists(path);
 321        }
 22
 23        /// <inheritdoc cref="IFileSystemHandler.CreateFolder"/>
 24        public void CreateFolder([NotNull] string path)
 125        {
 126            Check.NotNullOrEmpty(path, nameof(path));
 27
 028            Directory.CreateDirectory(path);
 029        }
 30
 31        /// <inheritdoc cref="IFileSystemHandler.EnumerateFiles"/>
 32        public IEnumerable<string> EnumerateFiles([NotNull] string path)
 233        {
 234            Check.NotNullOrEmpty(path, nameof(path));
 35
 236            return Directory.EnumerateFiles(path);
 237        }
 38
 39        /// <inheritdoc cref="IFileSystemHandler.GetMappingFolder"/>
 40        public string GetMappingFolder()
 141        {
 142            return Path.Combine(Directory.GetCurrentDirectory(), AdminMappingsFolder);
 143        }
 44
 45        /// <inheritdoc cref="IFileSystemHandler.ReadMappingFile"/>
 46        public string ReadMappingFile([NotNull] string path)
 947        {
 948            Check.NotNullOrEmpty(path, nameof(path));
 49
 950            return File.ReadAllText(path);
 951        }
 52
 53        /// <inheritdoc cref="IFileSystemHandler.WriteMappingFile"/>
 54        public void WriteMappingFile([NotNull] string path, [NotNull] string text)
 155        {
 156            Check.NotNullOrEmpty(path, nameof(path));
 057            Check.NotNull(text, nameof(text));
 58
 059            File.WriteAllText(path, text);
 060        }
 61    }
 62}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Handlers\LocalFileSystemHandler.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_LogEntry.htm b/report/coverlet/WireMock.Net_LogEntry.htm index a346e7da..6173f5ab 100644 --- a/report/coverlet/WireMock.Net_LogEntry.htm +++ b/report/coverlet/WireMock.Net_LogEntry.htm @@ -20,77 +20,14 @@ Covered lines:6 Uncovered lines:0 Coverable lines:6 -Total lines:59 +Total lines:0 Line coverage:100%

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Logging\LogEntry.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using WireMock.Matchers.Request;
 3
 4namespace WireMock.Logging
 5{
 6    /// <summary>
 7    /// LogEntry
 8    /// </summary>
 9    public class LogEntry
 10    {
 11        /// <summary>
 12        /// Gets or sets the unique identifier.
 13        /// </summary>
 14        /// <value>
 15        /// The unique identifier.
 16        /// </value>
 10417        public Guid Guid { get; set; }
 18
 19        /// <summary>
 20        /// Gets or sets the request message.
 21        /// </summary>
 22        /// <value>
 23        /// The request message.
 24        /// </value>
 88825        public RequestMessage RequestMessage { get; set; }
 26
 27        /// <summary>
 28        /// Gets or sets the response message.
 29        /// </summary>
 30        /// <value>
 31        /// The response message.
 32        /// </value>
 74733        public ResponseMessage ResponseMessage { get; set; }
 34
 35        /// <summary>
 36        /// Gets or sets the request match result.
 37        /// </summary>
 38        /// <value>
 39        /// The request match result.
 40        /// </value>
 27741        public RequestMatchResult RequestMatchResult { get; set; }
 42
 43        /// <summary>
 44        /// Gets or sets the mapping unique identifier.
 45        /// </summary>
 46        /// <value>
 47        /// The mapping unique identifier.
 48        /// </value>
 10449        public Guid? MappingGuid { get; set; }
 50
 51        /// <summary>
 52        /// Gets or sets the mapping unique title.
 53        /// </summary>
 54        /// <value>
 55        /// The mapping unique title.
 56        /// </value>
 10457        public string MappingTitle { get; set; }
 58    }
 59}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Logging\LogEntry.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_LogEntryMapper.htm b/report/coverlet/WireMock.Net_LogEntryMapper.htm index 4007cb7c..d8d47089 100644 --- a/report/coverlet/WireMock.Net_LogEntryMapper.htm +++ b/report/coverlet/WireMock.Net_LogEntryMapper.htm @@ -20,7 +20,7 @@ Covered lines:60 Uncovered lines:0 Coverable lines:60 -Total lines:72 +Total lines:0 Line coverage:100% Branch coverage:87.5% @@ -34,84 +34,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Serialization\LogEntryMapper.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System.Linq;
 2using WireMock.Admin.Mappings;
 3using WireMock.Admin.Requests;
 4using WireMock.Logging;
 5
 6namespace WireMock.Serialization
 7{
 8    internal static class LogEntryMapper
 9    {
 10        public static LogEntryModel Map(LogEntry logEntry)
 5311        {
 5312            return new LogEntryModel
 5313            {
 5314                Guid = logEntry.Guid,
 5315                Request = new LogRequestModel
 5316                {
 5317                    DateTime = logEntry.RequestMessage.DateTime,
 5318                    ClientIP = logEntry.RequestMessage.ClientIP,
 5319                    Path = logEntry.RequestMessage.Path,
 5320                    AbsolutePath = logEntry.RequestMessage.AbsolutePath,
 5321                    Url = logEntry.RequestMessage.Url,
 5322                    AbsoluteUrl = logEntry.RequestMessage.AbsoluteUrl,
 5323                    Query = logEntry.RequestMessage.Query,
 5324                    Method = logEntry.RequestMessage.Method,
 5325                    Body = logEntry.RequestMessage.Body,
 5326                    BodyAsJson = logEntry.RequestMessage.BodyAsJson,
 5327                    BodyAsBytes = logEntry.RequestMessage.BodyAsBytes,
 5328                    Headers = logEntry.RequestMessage.Headers,
 5329                    Cookies = logEntry.RequestMessage.Cookies,
 5330                    BodyEncoding = logEntry.RequestMessage.BodyEncoding != null ? new EncodingModel
 5331                    {
 5332                        EncodingName = logEntry.RequestMessage.BodyEncoding.EncodingName,
 5333                        CodePage = logEntry.RequestMessage.BodyEncoding.CodePage,
 5334                        WebName = logEntry.RequestMessage.BodyEncoding.WebName
 5335                    } : null
 5336                },
 5337                Response = new LogResponseModel
 5338                {
 5339                    StatusCode = logEntry.ResponseMessage.StatusCode,
 5340                    BodyDestination = logEntry.ResponseMessage.BodyDestination,
 5341                    Body = logEntry.ResponseMessage.Body,
 5342                    BodyAsJson = logEntry.ResponseMessage.BodyAsJson,
 5343                    BodyAsBytes = logEntry.ResponseMessage.BodyAsBytes,
 5344                    BodyOriginal = logEntry.ResponseMessage.BodyOriginal,
 5345                    BodyAsFile = logEntry.ResponseMessage.BodyAsFile,
 5346                    BodyAsFileIsCached = logEntry.ResponseMessage.BodyAsFileIsCached,
 5347                    Headers = logEntry.ResponseMessage.Headers,
 5348                    BodyEncoding = logEntry.ResponseMessage.BodyEncoding != null ? new EncodingModel
 5349                    {
 5350                        EncodingName = logEntry.ResponseMessage.BodyEncoding.EncodingName,
 5351                        CodePage = logEntry.ResponseMessage.BodyEncoding.CodePage,
 5352                        WebName = logEntry.ResponseMessage.BodyEncoding.WebName
 5353                    } : null
 5354                },
 5355                MappingGuid = logEntry.MappingGuid,
 5356                MappingTitle = logEntry.MappingTitle,
 5357                RequestMatchResult = logEntry.RequestMatchResult != null ? new LogRequestMatchModel
 5358                {
 5359                    TotalScore = logEntry.RequestMatchResult.TotalScore,
 5360                    TotalNumber = logEntry.RequestMatchResult.TotalNumber,
 5361                    IsPerfectMatch = logEntry.RequestMatchResult.IsPerfectMatch,
 5362                    AverageTotalScore = logEntry.RequestMatchResult.AverageTotalScore,
 13363                    MatchDetails = logEntry.RequestMatchResult.MatchDetails.Select(x => new
 13364                    {
 13365                        Name = x.Key.Name.Replace("RequestMessage", string.Empty),
 13366                        Score = x.Value
 13367                    } as object).ToList()
 5368                } : null
 5369            };
 5470        }
 71    }
 72}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Serialization\LogEntryMapper.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_LogEntryModel.htm b/report/coverlet/WireMock.Net_LogEntryModel.htm index 10c9cc7e..e0eddc62 100644 --- a/report/coverlet/WireMock.Net_LogEntryModel.htm +++ b/report/coverlet/WireMock.Net_LogEntryModel.htm @@ -20,58 +20,14 @@ Covered lines:6 Uncovered lines:0 Coverable lines:6 -Total lines:40 +Total lines:0 Line coverage:100%

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Admin\Requests\LogEntryModel.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2
 3namespace WireMock.Admin.Requests
 4{
 5    /// <summary>
 6    /// Request Log Model
 7    /// </summary>
 8    public class LogEntryModel
 9    {
 10        /// <summary>
 11        /// The unique identifier.
 12        /// </summary>
 6113        public Guid Guid { get; set; }
 14
 15        /// <summary>
 16        /// The request.
 17        /// </summary>
 7818        public LogRequestModel Request { get; set; }
 19
 20        /// <summary>
 21        /// The response.
 22        /// </summary>
 6623        public LogResponseModel Response { get; set; }
 24
 25        /// <summary>
 26        /// The mapping unique identifier.
 27        /// </summary>
 5828        public Guid? MappingGuid { get; set; }
 29
 30        /// <summary>
 31        /// The mapping unique title.
 32        /// </summary>
 5833        public string MappingTitle { get; set; }
 34
 35        /// <summary>
 36        /// The request match result.
 37        /// </summary>
 5838        public LogRequestMatchModel RequestMatchResult { get; set; }
 39    }
 40}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Admin\Requests\LogEntryModel.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_LogRequestMatchModel.htm b/report/coverlet/WireMock.Net_LogRequestMatchModel.htm index ec89cb8c..b8a83aa1 100644 --- a/report/coverlet/WireMock.Net_LogRequestMatchModel.htm +++ b/report/coverlet/WireMock.Net_LogRequestMatchModel.htm @@ -20,68 +20,14 @@ Covered lines:5 Uncovered lines:0 Coverable lines:5 -Total lines:50 +Total lines:0 Line coverage:100%

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Admin\Requests\LogRequestMatchModel.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System.Collections.Generic;
 2
 3namespace WireMock.Admin.Requests
 4{
 5    /// <summary>
 6    /// LogRequestMatchModel
 7    /// </summary>
 8    public class LogRequestMatchModel
 9    {
 10        /// <summary>
 11        /// Gets or sets the match-score.
 12        /// </summary>
 13        /// <value>
 14        /// The match-score.
 15        /// </value>
 3416        public double TotalScore { get; set; }
 17
 18        /// <summary>
 19        /// Gets or sets the total number of matches.
 20        /// </summary>
 21        /// <value>
 22        /// The total number of matches.
 23        /// </value>
 3524        public int TotalNumber { get; set; }
 25
 26        /// <summary>
 27        /// Gets or sets a value indicating whether this instance is perfect match.
 28        /// </summary>
 29        /// <value>
 30        /// <c>true</c> if this instance is perfect match; otherwise, <c>false</c>.
 31        /// </value>
 3532        public bool IsPerfectMatch { get; set; }
 33
 34        /// <summary>
 35        /// Gets the match percentage.
 36        /// </summary>
 37        /// <value>
 38        /// The match percentage.
 39        /// </value>
 3540        public double AverageTotalScore { get; set; }
 41
 42        /// <summary>
 43        /// Gets the match details.
 44        /// </summary>
 45        /// <value>
 46        /// The match details.
 47        /// </value>
 3548        public IList<object> MatchDetails { get; set; }
 49    }
 50}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Admin\Requests\LogRequestMatchModel.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_LogRequestModel.htm b/report/coverlet/WireMock.Net_LogRequestModel.htm index 0fb77e08..2554937b 100644 --- a/report/coverlet/WireMock.Net_LogRequestModel.htm +++ b/report/coverlet/WireMock.Net_LogRequestModel.htm @@ -20,101 +20,14 @@ Covered lines:14 Uncovered lines:0 Coverable lines:14 -Total lines:83 +Total lines:0 Line coverage:100%

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Admin\Requests\LogRequestModel.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using WireMock.Admin.Mappings;
 4using WireMock.Util;
 5
 6namespace WireMock.Admin.Requests
 7{
 8    /// <summary>
 9    /// RequestMessage Model
 10    /// </summary>
 11    public class LogRequestModel
 12    {
 13        /// <summary>
 14        /// The Client IP Address.
 15        /// </summary>
 6116        public string ClientIP { get; set; }
 17
 18        /// <summary>
 19        /// The DateTime.
 20        /// </summary>
 6221        public DateTime DateTime { get; set; }
 22
 23        /// <summary>
 24        /// The Path.
 25        /// </summary>
 6426        public string Path { get; set; }
 27
 28        /// <summary>
 29        /// The Absolute Path.
 30        /// </summary>
 6231        public string AbsolutePath { get; set; }
 32
 33        /// <summary>
 34        /// Gets the url (relative).
 35        /// </summary>
 6136        public string Url { get; set; }
 37
 38        /// <summary>
 39        /// The absolete URL.
 40        /// </summary>
 6141        public string AbsoluteUrl { get; set; }
 42
 43        /// <summary>
 44        /// The query.
 45        /// </summary>
 5746        public IDictionary<string, WireMockList<string>> Query { get; set; }
 47
 48        /// <summary>
 49        /// The method.
 50        /// </summary>
 6651        public string Method { get; set; }
 52
 53        /// <summary>
 54        /// The Headers.
 55        /// </summary>
 6656        public IDictionary<string, WireMockList<string>> Headers { get; set; }
 57
 58        /// <summary>
 59        /// Tthe Cookies.
 60        /// </summary>
 5861        public IDictionary<string, string> Cookies { get; set; }
 62
 63        /// <summary>
 64        /// The body (as string).
 65        /// </summary>
 6666        public string Body { get; set; }
 67
 68        /// <summary>
 69        /// The body (as JSON object).
 70        /// </summary>
 6271        public object BodyAsJson { get; set; }
 72
 73        /// <summary>
 74        /// The body (as bytearray).
 75        /// </summary>
 5776        public byte[] BodyAsBytes { get; set; }
 77
 78        /// <summary>
 79        /// The body encoding.
 80        /// </summary>
 6181        public EncodingModel BodyEncoding { get; set; }
 82    }
 83}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Admin\Requests\LogRequestModel.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_LogResponseModel.htm b/report/coverlet/WireMock.Net_LogResponseModel.htm index a23b9e4b..956a80d5 100644 --- a/report/coverlet/WireMock.Net_LogResponseModel.htm +++ b/report/coverlet/WireMock.Net_LogResponseModel.htm @@ -20,80 +20,14 @@ Covered lines:10 Uncovered lines:0 Coverable lines:10 -Total lines:62 +Total lines:0 Line coverage:100%

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Admin\Requests\LogResponseModel.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System.Collections.Generic;
 2using WireMock.Admin.Mappings;
 3using WireMock.Util;
 4
 5namespace WireMock.Admin.Requests
 6{
 7    /// <summary>
 8    /// Response MessageModel
 9    /// </summary>
 10    public class LogResponseModel
 11    {
 12        /// <summary>
 13        /// Gets or sets the status code.
 14        /// </summary>
 11815        public int StatusCode { get; set; } = 200;
 16
 17        /// <summary>
 18        /// Gets the headers.
 19        /// </summary>
 6620        public IDictionary<string, WireMockList<string>> Headers { get; set; }
 21
 22        /// <summary>
 23        /// Gets or sets the body destination (SameAsSource, String or Bytes).
 24        /// </summary>
 5725        public string BodyDestination { get; set; }
 26
 27        /// <summary>
 28        /// The body (as string).
 29        /// </summary>
 5730        public string Body { get; set; }
 31
 32        /// <summary>
 33        /// The body (as JSON object).
 34        /// </summary>
 6635        public object BodyAsJson { get; set; }
 36
 37        /// <summary>
 38        /// The body (as bytearray).
 39        /// </summary>
 5740        public byte[] BodyAsBytes { get; set; }
 41
 42        /// <summary>
 43        /// Gets or sets the body as file.
 44        /// </summary>
 5845        public string BodyAsFile { get; set; }
 46
 47        /// <summary>
 48        /// Is the body as file cached?
 49        /// </summary>
 5850        public bool? BodyAsFileIsCached { get; set; }
 51
 52        /// <summary>
 53        /// Gets or sets the original body.
 54        /// </summary>
 5755        public string BodyOriginal { get; set; }
 56
 57        /// <summary>
 58        /// Gets or sets the body.
 59        /// </summary>
 6660        public EncodingModel BodyEncoding { get; set; }
 61    }
 62}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Admin\Requests\LogResponseModel.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_Mapping.htm b/report/coverlet/WireMock.Net_Mapping.htm index 7502d71b..3db44857 100644 --- a/report/coverlet/WireMock.Net_Mapping.htm +++ b/report/coverlet/WireMock.Net_Mapping.htm @@ -20,7 +20,7 @@ Covered lines:36 Uncovered lines:0 Coverable lines:36 -Total lines:105 +Total lines:0 Line coverage:100% Branch coverage:92.8% @@ -36,117 +36,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Mapping.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using System.Threading.Tasks;
 3using JetBrains.Annotations;
 4using WireMock.Matchers.Request;
 5using WireMock.ResponseProviders;
 6
 7namespace WireMock
 8{
 9    /// <summary>
 10    /// The Mapping.
 11    /// </summary>
 12    public class Mapping : IMapping
 13    {
 14        /// <inheritdoc cref="IMapping.Guid" />
 54115        public Guid Guid { get; }
 16
 17        /// <inheritdoc cref="IMapping.Title" />
 4218        public string Title { get; }
 19
 20        /// <inheritdoc cref="IMapping.Path" />
 25021        public string Path { get; set; }
 22
 23        /// <inheritdoc cref="IMapping.Priority" />
 11824        public int Priority { get; }
 25
 26        /// <inheritdoc cref="IMapping.Scenario" />
 27        [CanBeNull]
 101628        public string Scenario { get; }
 29
 30        /// <inheritdoc cref="IMapping.ExecutionConditionState" />
 31        [CanBeNull]
 3732        public string ExecutionConditionState { get; }
 33
 34        /// <inheritdoc cref="IMapping.NextState" />
 35        [CanBeNull]
 2936        public string NextState { get; }
 37
 38        /// <inheritdoc cref="IMapping.RequestMatcher" />
 28439        public IRequestMatcher RequestMatcher { get; }
 40
 41        /// <inheritdoc cref="IMapping.Provider" />
 32342        public IResponseProvider Provider { get; }
 43
 44        /// <inheritdoc cref="IMapping.IsStartState" />
 945        public bool IsStartState => Scenario == null || Scenario != null && NextState != null && ExecutionConditionState
 46
 47        /// <inheritdoc cref="IMapping.IsAdminInterface" />
 11048        public bool IsAdminInterface => Provider is DynamicResponseProvider || Provider is DynamicAsyncResponseProvider 
 49
 50        /// <summary>
 51        /// Initializes a new instance of the <see cref="Mapping"/> class.
 52        /// </summary>
 53        /// <param name="guid">The unique identifier.</param>
 54        /// <param name="title">The unique title (can be null).</param>
 55        /// <param name="path">The full file path from this mapping title (can be null).</param>
 56        /// <param name="requestMatcher">The request matcher.</param>
 57        /// <param name="provider">The provider.</param>
 58        /// <param name="priority">The priority for this mapping.</param>
 59        /// <param name="scenario">The scenario. [Optional]</param>
 60        /// <param name="executionConditionState">State in which the current mapping can occur. [Optional]</param>
 61        /// <param name="nextState">The next state which will occur after the current mapping execution. [Optional]</par
 25062        public Mapping(Guid guid, [CanBeNull] string title, [CanBeNull] string path, IRequestMatcher requestMatcher, IRe
 25063        {
 25064            Guid = guid;
 25065            Title = title;
 25066            Path = path;
 25067            RequestMatcher = requestMatcher;
 25068            Provider = provider;
 25069            Priority = priority;
 25070            Scenario = scenario;
 25071            ExecutionConditionState = executionConditionState;
 25072            NextState = nextState;
 25073        }
 74
 75        /// <inheritdoc cref="IMapping.ResponseToAsync" />
 76        public async Task<ResponseMessage> ResponseToAsync(RequestMessage requestMessage)
 3577        {
 3578            return await Provider.ProvideResponseAsync(requestMessage);
 3579        }
 80
 81        /// <inheritdoc cref="IMapping.GetRequestMatchResult" />
 82        public RequestMatchResult GetRequestMatchResult(RequestMessage requestMessage, [CanBeNull] string nextState)
 27983        {
 27984            var result = new RequestMatchResult();
 85
 27986            RequestMatcher.GetMatchingScore(requestMessage, result);
 87
 88            // Only check state if Scenario is defined
 27989            if (Scenario != null)
 3090            {
 3091                var matcher = new RequestMessageScenarioAndStateMatcher(nextState, ExecutionConditionState);
 3092                matcher.GetMatchingScore(requestMessage, result);
 93                //// If ExecutionConditionState is null, this means that request is the start from a scenario. So just r
 94                //if (ExecutionConditionState != null)
 95                //{
 96                //    // ExecutionConditionState is not null, so get score for matching with the nextState.
 97                //    var matcher = new RequestMessageScenarioAndStateMatcher(nextState, ExecutionConditionState);
 98                //    matcher.GetMatchingScore(requestMessage, result);
 99                //}
 30100            }
 101
 279102            return result;
 279103        }
 104    }
 105}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Mapping.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_MappingConverter.htm b/report/coverlet/WireMock.Net_MappingConverter.htm index 79425dd4..0f5b2caf 100644 --- a/report/coverlet/WireMock.Net_MappingConverter.htm +++ b/report/coverlet/WireMock.Net_MappingConverter.htm @@ -20,7 +20,7 @@ Covered lines:87 Uncovered lines:29 Coverable lines:116 -Total lines:142 +Total lines:0 Line coverage:75% Branch coverage:48.5% @@ -35,154 +35,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Serialization\MappingConverter.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System.Collections.Generic;
 2using System.Linq;
 3using WireMock.Admin.Mappings;
 4using WireMock.Matchers.Request;
 5using WireMock.RequestBuilders;
 6using WireMock.ResponseBuilders;
 7using WireMock.Util;
 8
 9namespace WireMock.Serialization
 10{
 11    internal static class MappingConverter
 12    {
 13        public static MappingModel ToMappingModel(IMapping mapping)
 214        {
 215            var request = (Request)mapping.RequestMatcher;
 216            var response = (Response)mapping.Provider;
 17
 218            var clientIPMatchers = request.GetRequestMessageMatchers<RequestMessageClientIPMatcher>();
 219            var pathMatchers = request.GetRequestMessageMatchers<RequestMessagePathMatcher>();
 220            var urlMatchers = request.GetRequestMessageMatchers<RequestMessageUrlMatcher>();
 221            var headerMatchers = request.GetRequestMessageMatchers<RequestMessageHeaderMatcher>();
 222            var cookieMatchers = request.GetRequestMessageMatchers<RequestMessageCookieMatcher>();
 223            var paramsMatchers = request.GetRequestMessageMatchers<RequestMessageParamMatcher>();
 224            var bodyMatcher = request.GetRequestMessageMatcher<RequestMessageBodyMatcher>();
 225            var methodMatcher = request.GetRequestMessageMatcher<RequestMessageMethodMatcher>();
 26
 227            var mappingModel = new MappingModel
 228            {
 229                Guid = mapping.Guid,
 230                Title = mapping.Title,
 231                Priority = mapping.Priority,
 232                Scenario = mapping.Scenario,
 233                WhenStateIs = mapping.ExecutionConditionState,
 234                SetStateTo = mapping.NextState,
 235                Request = new RequestModel
 236                {
 237                    ClientIP = clientIPMatchers != null && clientIPMatchers.Any() ? new ClientIPModel
 238                    {
 239                        Matchers = MatcherMapper.Map(clientIPMatchers.Where(m => m.Matchers != null).SelectMany(m => m.M
 240                    } : null,
 241
 242                    Path = pathMatchers != null && pathMatchers.Any() ? new PathModel
 243                    {
 444                        Matchers = MatcherMapper.Map(pathMatchers.Where(m => m.Matchers != null).SelectMany(m => m.Match
 245                    } : null,
 246
 247                    Url = urlMatchers != null && urlMatchers.Any() ? new UrlModel
 248                    {
 249                        Matchers = MatcherMapper.Map(urlMatchers.Where(m => m.Matchers != null).SelectMany(m => m.Matche
 250                    } : null,
 251
 252                    Methods = methodMatcher?.Methods,
 253
 254                    Headers = headerMatchers != null && headerMatchers.Any() ? headerMatchers.Select(hm => new HeaderMod
 255                    {
 256                        Name = hm.Name,
 257                        Matchers = MatcherMapper.Map(hm.Matchers)
 258                    }).ToList() : null,
 259
 260                    Cookies = cookieMatchers != null && cookieMatchers.Any() ? cookieMatchers.Select(cm => new CookieMod
 261                    {
 262                        Name = cm.Name,
 263                        Matchers = MatcherMapper.Map(cm.Matchers)
 264                    }).ToList() : null,
 265
 266                    Params = paramsMatchers != null && paramsMatchers.Any() ? paramsMatchers.Select(pm => new ParamModel
 267                    {
 268                        Name = pm.Key,
 269                        Matchers = MatcherMapper.Map(pm.Matchers)
 270                    }).ToList() : null,
 271
 272                    Body = methodMatcher?.Methods != null && methodMatcher.Methods.Any(m => m == "get") ? null : new Bod
 273                    {
 274                        Matcher = bodyMatcher != null ? MatcherMapper.Map(bodyMatcher.Matcher) : null
 275                    }
 276                },
 277                Response = new ResponseModel
 278                {
 279                    Delay = response.Delay?.Milliseconds
 280                }
 281            };
 82
 283            if (!string.IsNullOrEmpty(response.ProxyUrl))
 084            {
 085                mappingModel.Response.StatusCode = null;
 086                mappingModel.Response.Headers = null;
 087                mappingModel.Response.BodyDestination = null;
 088                mappingModel.Response.BodyAsJson = null;
 089                mappingModel.Response.BodyAsJsonIndented = null;
 090                mappingModel.Response.Body = null;
 091                mappingModel.Response.BodyAsBytes = null;
 092                mappingModel.Response.BodyAsFile = null;
 093                mappingModel.Response.BodyAsFileIsCached = null;
 094                mappingModel.Response.UseTransformer = false;
 095                mappingModel.Response.BodyEncoding = null;
 096                mappingModel.Response.ProxyUrl = response.ProxyUrl;
 097            }
 98            else
 299            {
 2100                mappingModel.Response.BodyDestination = response.ResponseMessage.BodyDestination;
 2101                mappingModel.Response.StatusCode = response.ResponseMessage.StatusCode;
 2102                mappingModel.Response.Headers = Map(response.ResponseMessage.Headers);
 2103                mappingModel.Response.BodyAsJson = response.ResponseMessage.BodyAsJson;
 2104                mappingModel.Response.BodyAsJsonIndented = response.ResponseMessage.BodyAsJsonIndented;
 2105                mappingModel.Response.Body = response.ResponseMessage.Body;
 2106                mappingModel.Response.BodyAsBytes = response.ResponseMessage.BodyAsBytes;
 2107                mappingModel.Response.BodyAsFile = response.ResponseMessage.BodyAsFile;
 2108                mappingModel.Response.BodyAsFileIsCached = response.ResponseMessage.BodyAsFileIsCached;
 2109                mappingModel.Response.UseTransformer = response.UseTransformer;
 110
 2111                if (response.ResponseMessage.BodyEncoding != null && response.ResponseMessage.BodyEncoding.WebName != "u
 0112                {
 0113                    mappingModel.Response.BodyEncoding = new EncodingModel
 0114                    {
 0115                        EncodingName = response.ResponseMessage.BodyEncoding.EncodingName,
 0116                        CodePage = response.ResponseMessage.BodyEncoding.CodePage,
 0117                        WebName = response.ResponseMessage.BodyEncoding.WebName
 0118                    };
 0119                }
 2120            }
 121
 2122            return mappingModel;
 2123        }
 124
 125        private static IDictionary<string, object> Map(IDictionary<string, WireMockList<string>> dictionary)
 2126        {
 2127            if (dictionary == null || dictionary.Count == 0)
 2128            {
 2129                return null;
 130            }
 131
 0132            var newDictionary = new Dictionary<string, object>();
 0133            foreach (var entry in dictionary)
 0134            {
 0135                object value = entry.Value.Count == 1 ? (object)entry.Value.ToString() : entry.Value;
 0136                newDictionary.Add(entry.Key, value);
 0137            }
 138
 0139            return newDictionary;
 2140        }
 141    }
 142}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Serialization\MappingConverter.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_MappingMatcher.htm b/report/coverlet/WireMock.Net_MappingMatcher.htm index d4dcdba5..9b342e83 100644 --- a/report/coverlet/WireMock.Net_MappingMatcher.htm +++ b/report/coverlet/WireMock.Net_MappingMatcher.htm @@ -20,7 +20,7 @@ Covered lines:27 Uncovered lines:0 Coverable lines:27 -Total lines:48 +Total lines:0 Line coverage:100% Branch coverage:90.9% @@ -35,60 +35,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Owin\MappingMatcher.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System.Linq;
 2using WireMock.Matchers.Request;
 3using WireMock.Validation;
 4
 5namespace WireMock.Owin
 6{
 7    internal class MappingMatcher : IMappingMatcher
 8    {
 9        private readonly IWireMockMiddlewareOptions _options;
 10
 5011        public MappingMatcher(IWireMockMiddlewareOptions options)
 5012        {
 5013            Check.NotNull(options, nameof(options));
 14
 5015            _options = options;
 5016        }
 17
 18        public (IMapping Mapping, RequestMatchResult RequestMatchResult) Match(RequestMessage request)
 4919        {
 4920            var mappings = _options.Mappings.Values
 33221                .Select(m => new
 33222                {
 33223                    Mapping = m,
 33224                    MatchResult = m.GetRequestMatchResult(request, m.Scenario != null && _options.Scenarios.ContainsKey(
 33225                })
 4926                .ToList();
 27
 4928            if (_options.AllowPartialMapping)
 129            {
 130                var partialMappings = mappings
 331                    .Where(pm => (pm.Mapping.IsAdminInterface && pm.MatchResult.IsPerfectMatch) || !pm.Mapping.IsAdminIn
 332                    .OrderBy(m => m.MatchResult)
 333                    .ThenBy(m => m.Mapping.Priority)
 134                    .ToList();
 35
 236                var bestPartialMatch = partialMappings.FirstOrDefault(pm => pm.MatchResult.AverageTotalScore > 0.0);
 37
 138                return (bestPartialMatch?.Mapping, bestPartialMatch?.MatchResult);
 39            }
 40
 4841            var perfectMatch = mappings
 8542                .OrderBy(m => m.Mapping.Priority)
 32943                .FirstOrDefault(m => m.MatchResult.IsPerfectMatch);
 44
 4845            return (perfectMatch?.Mapping, perfectMatch?.MatchResult);
 4946        }
 47    }
 48}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Owin\MappingMatcher.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_MappingModel.htm b/report/coverlet/WireMock.Net_MappingModel.htm index a1145b91..fe30b0c1 100644 --- a/report/coverlet/WireMock.Net_MappingModel.htm +++ b/report/coverlet/WireMock.Net_MappingModel.htm @@ -20,69 +20,14 @@ Covered lines:8 Uncovered lines:0 Coverable lines:8 -Total lines:51 +Total lines:0 Line coverage:100%

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Admin\Mappings\MappingModel.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2
 3namespace WireMock.Admin.Mappings
 4{
 5    /// <summary>
 6    /// MappingModel
 7    /// </summary>
 8    public class MappingModel
 9    {
 10        /// <summary>
 11        /// Gets or sets the unique identifier.
 12        /// </summary>
 2513        public Guid? Guid { get; set; }
 14
 15        /// <summary>
 16        /// The unique title.
 17        /// </summary>
 2418        public string Title { get; set; }
 19
 20        /// <summary>
 21        /// The priority.
 22        /// </summary>
 3623        public int? Priority { get; set; }
 24
 25        /// <summary>
 26        /// The Scenario.
 27        /// </summary>
 1628        public string Scenario { get; set; }
 29
 30        /// <summary>
 31        /// Execution state condition for the current mapping.
 32        /// </summary>
 533        public string WhenStateIs { get; set; }
 34
 35        /// <summary>
 36        /// The next state which will be signaled after the current mapping execution.
 37        /// In case the value is null state will not be changed.
 38        /// </summary>
 539        public string SetStateTo { get; set; }
 40
 41        /// <summary>
 42        /// The request.
 43        /// </summary>
 4944        public RequestModel Request { get; set; }
 45
 46        /// <summary>
 47        /// The response.
 48        /// </summary>
 6949        public ResponseModel Response { get; set; }
 50    }
 51}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Admin\Mappings\MappingModel.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_MatchBehaviourHelper.htm b/report/coverlet/WireMock.Net_MatchBehaviourHelper.htm index 29ebe1ee..edf5c1a5 100644 --- a/report/coverlet/WireMock.Net_MatchBehaviourHelper.htm +++ b/report/coverlet/WireMock.Net_MatchBehaviourHelper.htm @@ -20,7 +20,7 @@ Covered lines:6 Uncovered lines:0 Coverable lines:6 -Total lines:27 +Total lines:0 Line coverage:100% Branch coverage:100% @@ -34,39 +34,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\MatchBehaviourHelper.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1namespace WireMock.Matchers
 2{
 3    internal static class MatchBehaviourHelper
 4    {
 5        /// <summary>
 6        /// Converts the specified match behaviour and match value to a new match value.
 7        ///
 8        /// if AcceptOnMatch --> return match (default)
 9        /// if RejectOnMatch and match = 0.0 --> return 1.0
 10        /// if RejectOnMatch and match = 0.? --> return 0.0
 11        /// if RejectOnMatch and match = 1.0 --> return 0.0
 12        /// </summary>
 13        ///
 14        /// <param name="matchBehaviour">The match behaviour.</param>
 15        /// <param name="match">The match.</param>
 16        /// <returns>match value</returns>
 17        internal static double Convert(MatchBehaviour matchBehaviour, double match)
 75818        {
 75819            if (matchBehaviour == MatchBehaviour.AcceptOnMatch)
 74020            {
 74021                return match;
 22            }
 23
 1824            return match <= MatchScores.Tolerance ? MatchScores.Perfect : MatchScores.Mismatch;
 75825        }
 26    }
 27}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\MatchBehaviourHelper.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_MatchScores.htm b/report/coverlet/WireMock.Net_MatchScores.htm index 88735ad6..002218d9 100644 --- a/report/coverlet/WireMock.Net_MatchScores.htm +++ b/report/coverlet/WireMock.Net_MatchScores.htm @@ -20,7 +20,7 @@ Covered lines:9 Uncovered lines:0 Coverable lines:9 -Total lines:61 +Total lines:0 Line coverage:100% Branch coverage:66.6% @@ -36,73 +36,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\MatchScores.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System.Collections.Generic;
 2using System.Linq;
 3
 4namespace WireMock.Matchers
 5{
 6    /// <summary>
 7    /// MatchScores
 8    /// </summary>
 9    public static class MatchScores
 10    {
 11        /// <summary>
 12        /// The tolerance
 13        /// </summary>
 14        public const double Tolerance = 0.0001;
 15
 16        /// <summary>
 17        /// The default mismatch score
 18        /// </summary>
 19        public const double Mismatch = 0.0;
 20
 21        /// <summary>
 22        /// The default perfect match score
 23        /// </summary>
 24        public const double Perfect = 1.0;
 25
 26        /// <summary>
 27        /// The almost perfect match score
 28        /// </summary>
 29        public const double AlmostPerfect = 0.99;
 30
 31        /// <summary>
 32        /// Convert a bool to the score.
 33        /// </summary>
 34        /// <param name="value">if set to <c>true</c> [value].</param>
 35        /// <returns>score</returns>
 36        public static double ToScore(bool value)
 71837        {
 71838            return value ? Perfect : Mismatch;
 71839        }
 40
 41        /// <summary>
 42        /// Calculates the score from multiple funcs.
 43        /// </summary>
 44        /// <param name="values">The values.</param>
 45        /// <returns>average score</returns>
 46        public static double ToScore(IEnumerable<bool> values)
 40847        {
 40848            return values.Any() ? values.Select(ToScore).Average() : Mismatch;
 40849        }
 50
 51        /// <summary>
 52        /// Calculates the score from multiple funcs.
 53        /// </summary>
 54        /// <param name="values">The values.</param>
 55        /// <returns>average score</returns>
 56        public static double ToScore(IEnumerable<double> values)
 457        {
 458            return values.Any() ? values.Average() : Mismatch;
 459        }
 60    }
 61}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\MatchScores.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_MatcherMapper.htm b/report/coverlet/WireMock.Net_MatcherMapper.htm index cc859945..5aca490c 100644 --- a/report/coverlet/WireMock.Net_MatcherMapper.htm +++ b/report/coverlet/WireMock.Net_MatcherMapper.htm @@ -20,7 +20,7 @@ Covered lines:43 Uncovered lines:3 Coverable lines:46 -Total lines:96 +Total lines:0 Line coverage:93.4% Branch coverage:86.7% @@ -36,108 +36,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Serialization\MatcherMapper.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using System.Linq;
 4using JetBrains.Annotations;
 5using SimMetrics.Net;
 6using WireMock.Admin.Mappings;
 7using WireMock.Matchers;
 8
 9namespace WireMock.Serialization
 10{
 11    internal static class MatcherMapper
 12    {
 13        public static IMatcher Map([CanBeNull] MatcherModel matcher)
 2614        {
 2615            if (matcher == null)
 216            {
 217                return null;
 18            }
 19
 2420            string[] parts = matcher.Name.Split('.');
 2421            string matcherName = parts[0];
 2422            string matcherType = parts.Length > 1 ? parts[1] : null;
 23
 2424            string[] stringPatterns = matcher.Patterns != null ? matcher.Patterns.Cast<string>().ToArray() : new[] { mat
 2425            MatchBehaviour matchBehaviour = matcher.RejectOnMatch == true ? MatchBehaviour.RejectOnMatch : MatchBehaviou
 26
 2427            switch (matcherName)
 28            {
 29                case "LinqMatcher":
 230                    return new LinqMatcher(matchBehaviour, stringPatterns);
 31
 32                case "ExactMatcher":
 1133                    return new ExactMatcher(matchBehaviour, stringPatterns);
 34
 35                case "RegexMatcher":
 136                    return new RegexMatcher(matchBehaviour, stringPatterns, matcher.IgnoreCase == true);
 37
 38                case "JsonMatcher":
 039                    return new JsonMatcher(matchBehaviour, matcher.Pattern);
 40
 41                case "JsonPathMatcher":
 042                    return new JsonPathMatcher(matchBehaviour, stringPatterns);
 43
 44                case "XPathMatcher":
 045                    return new XPathMatcher(matchBehaviour, (string)matcher.Pattern);
 46
 47                case "WildcardMatcher":
 548                    return new WildcardMatcher(matchBehaviour, stringPatterns, matcher.IgnoreCase == true);
 49
 50                case "SimMetricsMatcher":
 351                    SimMetricType type = SimMetricType.Levenstein;
 352                    if (!string.IsNullOrEmpty(matcherType) && !Enum.TryParse(matcherType, out type))
 153                    {
 154                        throw new NotSupportedException($"Matcher '{matcherName}' with Type '{matcherType}' is not suppo
 55                    }
 56
 257                    return new SimMetricsMatcher(matchBehaviour, (string)matcher.Pattern, type);
 58
 59                default:
 260                    throw new NotSupportedException($"Matcher '{matcherName}' is not supported.");
 61            }
 2362        }
 63
 64        public static MatcherModel[] Map([CanBeNull] IEnumerable<IMatcher> matchers)
 365        {
 666            return matchers?.Select(Map).Where(x => x != null).ToArray();
 367        }
 68
 69        public static MatcherModel Map([CanBeNull] IMatcher matcher)
 870        {
 871            if (matcher == null)
 272            {
 273                return null;
 74            }
 75
 76            // If the matcher is a IStringMatcher, get the patterns.
 77            // If the matcher is a IValueMatcher, get the value (can be string or object).
 78            // Else empty array
 679            object[] patterns = matcher is IStringMatcher stringMatcher ?
 680                stringMatcher.GetPatterns().Cast<object>().ToArray() :
 681                matcher is IValueMatcher valueMatcher ? new[] { valueMatcher.Value } :
 682                new object[0];
 683            bool? ignorecase = matcher is IIgnoreCaseMatcher ignoreCaseMatcher ? ignoreCaseMatcher.IgnoreCase : (bool?)n
 684            bool? rejectOnMatch = matcher.MatchBehaviour == MatchBehaviour.RejectOnMatch ? true : (bool?)null;
 85
 686            return new MatcherModel
 687            {
 688                RejectOnMatch = rejectOnMatch,
 689                IgnoreCase = ignorecase,
 690                Name = matcher.Name,
 691                Pattern = patterns.Length == 1 ? patterns.First() : null,
 692                Patterns = patterns.Length > 1 ? patterns : null
 693            };
 894        }
 95    }
 96}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Serialization\MatcherMapper.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_MatcherModel.htm b/report/coverlet/WireMock.Net_MatcherModel.htm index 6ae20cb2..4349767d 100644 --- a/report/coverlet/WireMock.Net_MatcherModel.htm +++ b/report/coverlet/WireMock.Net_MatcherModel.htm @@ -20,51 +20,14 @@ Covered lines:5 Uncovered lines:0 Coverable lines:5 -Total lines:33 +Total lines:0 Line coverage:100%

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Admin\Mappings\MatcherModel.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1namespace WireMock.Admin.Mappings
 2{
 3    /// <summary>
 4    /// MatcherModel
 5    /// </summary>
 6    public class MatcherModel
 7    {
 8        /// <summary>
 9        /// Gets or sets the name.
 10        /// </summary>
 5711        public string Name { get; set; }
 12
 13        /// <summary>
 14        /// Gets or sets the pattern. Can be a string (default) or an object;
 15        /// </summary>
 4816        public object Pattern { get; set; }
 17
 18        /// <summary>
 19        /// Gets or sets the patterns. Can be array of strings (default) or an array of objects;
 20        /// </summary>
 4321        public object[] Patterns { get; set; }
 22
 23        /// <summary>
 24        /// Gets or sets the ignore case.
 25        /// </summary>
 1826        public bool? IgnoreCase { get; set; }
 27
 28        /// <summary>
 29        /// Reject on match.
 30        /// </summary>
 3131        public bool? RejectOnMatch { get; set; }
 32    }
 33}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Admin\Mappings\MatcherModel.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_OwinRequestMapper.htm b/report/coverlet/WireMock.Net_OwinRequestMapper.htm index a5cb26b6..745ddd7c 100644 --- a/report/coverlet/WireMock.Net_OwinRequestMapper.htm +++ b/report/coverlet/WireMock.Net_OwinRequestMapper.htm @@ -20,7 +20,7 @@ Covered lines:32 Uncovered lines:7 Coverable lines:39 -Total lines:89 +Total lines:0 Line coverage:82% Branch coverage:62.5% @@ -36,101 +36,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Owin\Mappers\OwinRequestMapper.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using System.Linq;
 4using System.Threading.Tasks;
 5using WireMock.Models;
 6using WireMock.Util;
 7#if !USE_ASPNETCORE
 8using IRequest = Microsoft.Owin.IOwinRequest;
 9#else
 10using Microsoft.AspNetCore.Http;
 11using Microsoft.AspNetCore.Http.Extensions;
 12using IRequest = Microsoft.AspNetCore.Http.HttpRequest;
 13#endif
 14
 15namespace WireMock.Owin.Mappers
 16{
 17    /// <summary>
 18    /// OwinRequestMapper
 19    /// </summary>
 20    internal class OwinRequestMapper : IOwinRequestMapper
 21    {
 22        /// <inheritdoc cref="IOwinRequestMapper.MapAsync"/>
 23        public async Task<RequestMessage> MapAsync(IRequest request)
 4624        {
 4625            (UrlDetails urldetails, string clientIP) = ParseRequest(request);
 26
 4627            string method = request.Method;
 28
 4629            Dictionary<string, string[]> headers = null;
 4630            if (request.Headers.Any())
 4531            {
 4532                headers = new Dictionary<string, string[]>();
 26033                foreach (var header in request.Headers)
 6234                {
 6235                    headers.Add(header.Key, header.Value);
 6236                }
 4637            }
 38
 4639            IDictionary<string, string> cookies = null;
 4640            if (request.Cookies.Any())
 041            {
 042                cookies = new Dictionary<string, string>();
 043                foreach (var cookie in request.Cookies)
 044                {
 045                    cookies.Add(cookie.Key, cookie.Value);
 046                }
 047            }
 48
 4649            BodyData body = null;
 4650            if (request.Body != null && ShouldParseBody(method))
 751            {
 752                body = await BodyParser.Parse(request.Body, request.ContentType);
 753            }
 54
 4655            return new RequestMessage(urldetails, method, clientIP, body, headers, cookies) { DateTime = DateTime.UtcNow
 4656        }
 57
 58        private (UrlDetails UrlDetails, string ClientIP) ParseRequest(IRequest request)
 4659        {
 60#if !USE_ASPNETCORE
 61            var urldetails = UrlUtils.Parse(request.Uri, request.PathBase);
 62            string clientIP = request.RemoteIpAddress;
 63#else
 4664            var urldetails = UrlUtils.Parse(new Uri(request.GetEncodedUrl()), request.PathBase);
 4665            var connection = request.HttpContext.Connection;
 4666            string clientIP = connection.RemoteIpAddress.IsIPv4MappedToIPv6
 4667                ? connection.RemoteIpAddress.MapToIPv4().ToString()
 4668                : connection.RemoteIpAddress.ToString();
 69#endif
 4570            return (urldetails, clientIP);
 4671        }
 72
 73        private bool ShouldParseBody(string method)
 4674        {
 75            /*
 76                HEAD - No defined body semantics.
 77                GET - No defined body semantics.
 78                PUT - Body supported.
 79                POST - Body supported.
 80                DELETE - No defined body semantics.
 81                TRACE - Body not supported.
 82                OPTIONS - Body supported but no semantics on usage (maybe in the future).
 83                CONNECT - No defined body semantics
 84                PATCH - Body supported.
 85            */
 4686            return new[] { "PUT", "POST", "OPTIONS", "PATCH" }.Contains(method.ToUpper());
 4687        }
 88    }
 89}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Owin\Mappers\OwinRequestMapper.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_OwinResponseMapper.htm b/report/coverlet/WireMock.Net_OwinResponseMapper.htm index 1444546b..f4e304c5 100644 --- a/report/coverlet/WireMock.Net_OwinResponseMapper.htm +++ b/report/coverlet/WireMock.Net_OwinResponseMapper.htm @@ -20,7 +20,7 @@ Covered lines:44 Uncovered lines:3 Coverable lines:47 -Total lines:100 +Total lines:0 Line coverage:93.6% Branch coverage:76.9% @@ -37,112 +37,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Owin\Mappers\OwinResponseMapper.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using System.IO;
 4using System.Linq;
 5using System.Text;
 6using System.Threading.Tasks;
 7using Newtonsoft.Json;
 8using WireMock.Http;
 9using WireMock.Util;
 10#if !USE_ASPNETCORE
 11using System.Net;
 12using Microsoft.Owin;
 13using IResponse = Microsoft.Owin.IOwinResponse;
 14#else
 15using Microsoft.AspNetCore.Http;
 16using IResponse = Microsoft.AspNetCore.Http.HttpResponse;
 17#endif
 18
 19namespace WireMock.Owin.Mappers
 20{
 21    /// <summary>
 22    /// OwinResponseMapper
 23    /// </summary>
 24    public class OwinResponseMapper : IOwinResponseMapper
 25    {
 5426        private readonly Encoding _utf8NoBom = new UTF8Encoding(false);
 27
 28        // https://msdn.microsoft.com/en-us/library/78h415ay(v=vs.110).aspx
 29#if !USE_ASPNETCORE
 30        private static readonly IDictionary<string, Action<IResponse, WireMockList<string>>> ResponseHeadersToFix = new 
 31#else
 132        private static readonly IDictionary<string, Action<IResponse, WireMockList<string>>> ResponseHeadersToFix = new 
 133#endif
 2034            { HttpKnownHeaderNames.ContentType, (r, v) => r.ContentType = v.FirstOrDefault() }
 135        };
 36
 37        /// <inheritdoc cref="IOwinResponseMapper.MapAsync"/>
 38        public async Task MapAsync(ResponseMessage responseMessage, IResponse response)
 5339        {
 5340            if (responseMessage == null)
 141            {
 142                return;
 43            }
 44
 5245            response.StatusCode = responseMessage.StatusCode;
 46
 5247            byte[] bytes = null;
 5248            if (responseMessage.BodyAsBytes != null)
 149            {
 150                bytes = responseMessage.BodyAsBytes;
 151            }
 5152            else if (responseMessage.BodyAsFile != null)
 053            {
 054                bytes = File.ReadAllBytes(responseMessage.BodyAsFile);
 055            }
 5056            else if (responseMessage.BodyAsJson != null)
 1557            {
 1558                Formatting formatting = responseMessage.BodyAsJsonIndented == true ? Formatting.Indented : Formatting.No
 1559                string jsonBody = JsonConvert.SerializeObject(responseMessage.BodyAsJson, new JsonSerializerSettings { F
 1560                bytes = (responseMessage.BodyEncoding ?? _utf8NoBom).GetBytes(jsonBody);
 1561            }
 3562            else if (responseMessage.Body != null)
 1963            {
 1864                bytes = (responseMessage.BodyEncoding ?? _utf8NoBom).GetBytes(responseMessage.Body);
 1965            }
 66
 5267            SetResponseHeaders(responseMessage, response);
 68
 5269            if (bytes != null)
 3570            {
 3571                await response.Body.WriteAsync(bytes, 0, bytes.Length);
 3572            }
 5373        }
 74
 75        private void SetResponseHeaders(ResponseMessage responseMessage, IResponse response)
 5176        {
 77            // Set headers
 20178            foreach (var pair in responseMessage.Headers)
 2379            {
 2380                if (ResponseHeadersToFix.ContainsKey(pair.Key))
 1981                {
 1982                    ResponseHeadersToFix[pair.Key]?.Invoke(response, pair.Value);
 1983                }
 84                else
 485                {
 86#if !USE_ASPNETCORE
 87                    // For non-NETSTANDARD, check if this response header can be added (#148)
 88                    if (!WebHeaderCollection.IsRestricted(pair.Key, true))
 89                    {
 90                        response.Headers.AppendValues(pair.Key, pair.Value.ToArray());
 91                    }
 92#else
 93                    // NETSTANDARD can add any header (or so it seems)
 494                    response.Headers.Append(pair.Key, pair.Value.ToArray());
 95#endif
 496                }
 2397            }
 5298        }
 99    }
 100}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Owin\Mappers\OwinResponseMapper.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_ParamModel.htm b/report/coverlet/WireMock.Net_ParamModel.htm index fea223dd..6f5603da 100644 --- a/report/coverlet/WireMock.Net_ParamModel.htm +++ b/report/coverlet/WireMock.Net_ParamModel.htm @@ -20,36 +20,14 @@ Covered lines:0 Uncovered lines:2 Coverable lines:2 -Total lines:18 +Total lines:0 Line coverage:0%

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Admin\Mappings\ParamModel.cs

- - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1namespace WireMock.Admin.Mappings
 2{
 3    /// <summary>
 4    /// Param Model
 5    /// </summary>
 6    public class ParamModel
 7    {
 8        /// <summary>
 9        /// Gets or sets the name.
 10        /// </summary>
 011        public string Name { get; set; }
 12
 13        /// <summary>
 14        /// Gets or sets the matchers.
 15        /// </summary>
 016        public MatcherModel[] Matchers { get; set; }
 17    }
 18}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Admin\Mappings\ParamModel.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_PathModel.htm b/report/coverlet/WireMock.Net_PathModel.htm index 3f82fc57..a884b91c 100644 --- a/report/coverlet/WireMock.Net_PathModel.htm +++ b/report/coverlet/WireMock.Net_PathModel.htm @@ -20,31 +20,14 @@ Covered lines:1 Uncovered lines:0 Coverable lines:1 -Total lines:13 +Total lines:0 Line coverage:100%

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Admin\Mappings\PathModel.cs

- - - - - - - - - - - - - - - - - -
#LineLine coverage
 1namespace WireMock.Admin.Mappings
 2{
 3    /// <summary>
 4    /// PathModel
 5    /// </summary>
 6    public class PathModel
 7    {
 8        /// <summary>
 9        /// Gets or sets the matchers.
 10        /// </summary>
 4211        public MatcherModel[] Matchers { get; set; }
 12    }
 13}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Admin\Mappings\PathModel.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_PortUtils.htm b/report/coverlet/WireMock.Net_PortUtils.htm index dfa324fd..5be23cf5 100644 --- a/report/coverlet/WireMock.Net_PortUtils.htm +++ b/report/coverlet/WireMock.Net_PortUtils.htm @@ -20,7 +20,7 @@ Covered lines:23 Uncovered lines:0 Coverable lines:23 -Total lines:55 +Total lines:0 Line coverage:100% Branch coverage:100% @@ -36,67 +36,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Util\PortUtils.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System.Net;
 2using System.Net.Sockets;
 3using System.Text.RegularExpressions;
 4
 5namespace WireMock.Util
 6{
 7    /// <summary>
 8    /// Port Utility class
 9    /// </summary>
 10    public static class PortUtils
 11    {
 112        private static readonly Regex UrlDetailsRegex = new Regex(@"^((?<proto>\w+)://)(?<host>[^/]+?):(?<port>\d+)\/?$"
 13
 14        /// <summary>
 15        /// Finds a free TCP port.
 16        /// </summary>
 17        /// <remarks>see http://stackoverflow.com/questions/138043/find-the-next-tcp-port-in-net.</remarks>
 18        public static int FindFreeTcpPort()
 4619        {
 4620            TcpListener tcpListener = null;
 21            try
 4622            {
 4623                tcpListener = new TcpListener(IPAddress.Loopback, 0);
 4624                tcpListener.Start();
 25
 4626                return ((IPEndPoint)tcpListener.LocalEndpoint).Port;
 27            }
 28            finally
 4629            {
 4630                tcpListener?.Stop();
 4631            }
 4632        }
 33
 34        /// <summary>
 35        /// Extract the protocol, host and port from a URL.
 36        /// </summary>
 37        public static bool TryExtract(string url, out string protocol, out string host, out int port)
 9838        {
 9839            protocol = null;
 9840            host = null;
 9841            port = default(int);
 42
 9843            Match m = UrlDetailsRegex.Match(url);
 9844            if (m.Success)
 9645            {
 9646                protocol = m.Groups["proto"].Value;
 9647                host = m.Groups["host"].Value;
 48
 9649                return int.TryParse(m.Groups["port"].Value, out port);
 50            }
 51
 252            return false;
 9853        }
 54    }
 55}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Util\PortUtils.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_ProxyAndRecordSettings.htm b/report/coverlet/WireMock.Net_ProxyAndRecordSettings.htm index 6ed2dcf9..0ac17836 100644 --- a/report/coverlet/WireMock.Net_ProxyAndRecordSettings.htm +++ b/report/coverlet/WireMock.Net_ProxyAndRecordSettings.htm @@ -20,48 +20,14 @@ Covered lines:5 Uncovered lines:0 Coverable lines:5 -Total lines:30 +Total lines:0 Line coverage:100%

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Settings\ProxyAndRecordSettings.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using JetBrains.Annotations;
 2
 3namespace WireMock.Settings
 4{
 5    /// <summary>
 6    /// ProxyAndRecordSettings
 7    /// </summary>
 8    public class ProxyAndRecordSettings : IProxyAndRecordSettings
 9    {
 10        /// <inheritdoc cref="IProxyAndRecordSettings.Url"/>
 11        [PublicAPI]
 412        public string Url { get; set; }
 13
 14        /// <inheritdoc cref="IProxyAndRecordSettings.SaveMapping"/>
 15        [PublicAPI]
 416        public bool SaveMapping { get; set; } = true;
 17
 18        /// <inheritdoc cref="IProxyAndRecordSettings.SaveMappingToFile"/>
 19        [PublicAPI]
 420        public bool SaveMappingToFile { get; set; } = true;
 21
 22        /// <inheritdoc cref="IProxyAndRecordSettings.ClientX509Certificate2ThumbprintOrSubjectName"/>
 23        [PublicAPI]
 424        public string ClientX509Certificate2ThumbprintOrSubjectName { get; set; }
 25
 26        /// <inheritdoc cref="IProxyAndRecordSettings.BlackListedHeaders"/>
 27        [PublicAPI]
 228        public string[] BlackListedHeaders { get; set; }
 29    }
 30}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Settings\ProxyAndRecordSettings.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_ProxyAsyncResponseProvider.htm b/report/coverlet/WireMock.Net_ProxyAsyncResponseProvider.htm index c3455b49..31846218 100644 --- a/report/coverlet/WireMock.Net_ProxyAsyncResponseProvider.htm +++ b/report/coverlet/WireMock.Net_ProxyAsyncResponseProvider.htm @@ -20,7 +20,7 @@ Covered lines:7 Uncovered lines:3 Coverable lines:10 -Total lines:28 +Total lines:0 Line coverage:70% @@ -34,40 +34,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\ResponseProviders\ProxyAsyncResponseProvider.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using System.Threading.Tasks;
 3using JetBrains.Annotations;
 4using WireMock.Settings;
 5using WireMock.Validation;
 6
 7namespace WireMock.ResponseProviders
 8{
 9    internal class ProxyAsyncResponseProvider : IResponseProvider
 10    {
 11        private readonly Func<RequestMessage, IProxyAndRecordSettings, Task<ResponseMessage>> _responseMessageFunc;
 12        private readonly IProxyAndRecordSettings _settings;
 13
 214        public ProxyAsyncResponseProvider([NotNull] Func<RequestMessage, IProxyAndRecordSettings, Task<ResponseMessage>>
 215        {
 216            Check.NotNull(responseMessageFunc, nameof(responseMessageFunc));
 217            Check.NotNull(settings, nameof(settings));
 18
 219            _responseMessageFunc = responseMessageFunc;
 220            _settings = settings;
 221        }
 22
 23        public Task<ResponseMessage> ProvideResponseAsync(RequestMessage requestMessage)
 024        {
 025            return _responseMessageFunc(requestMessage, _settings);
 026        }
 27    }
 28}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\ResponseProviders\ProxyAsyncResponseProvider.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_PublicCertificateHelper.htm b/report/coverlet/WireMock.Net_PublicCertificateHelper.htm index 1ecef335..2d4f4e27 100644 --- a/report/coverlet/WireMock.Net_PublicCertificateHelper.htm +++ b/report/coverlet/WireMock.Net_PublicCertificateHelper.htm @@ -20,7 +20,7 @@ Covered lines:0 Uncovered lines:4 Coverable lines:4 -Total lines:91 +Total lines:0 Line coverage:0% @@ -33,103 +33,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\HttpsCertificate\PublicCertificateHelper.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using System.Security.Cryptography.X509Certificates;
 3
 4namespace WireMock.HttpsCertificate
 5{
 6    internal static class PublicCertificateHelper
 7    {
 8        // 1] Generate using https://www.pluralsight.com/blog/software-development/selfcert-create-a-self-signed-certifi
 9        // 2] Converted to Base64
 10        private const string Data = @"MIIQMgIBAzCCD+4GCSqGSIb3DQEHAaCCD98Egg/bMIIP1zCCCogGCSqGSIb3DQEHAaCCCnkEggp1
 11MIIKcTCCCm0GCyqGSIb3DQEMCgECoIIJfjCCCXowHAYKKoZIhvcNAQwBAzAOBAi1j9x1jTfUewIC
 12B9AEgglYa48lP16+isiGEVT7zwN3XwaPwPOHZcQ7tRA/DA8LZnZbwU7XhtPObF5bZcHn4engX2An
 13ISFpe2S5XJ7BfHmsGOO7Bxj6C2IcZIPTefvAd9vWE0WUAGN11SLhJ3fB/ZRt3Nys7JCJzywQCkYK
 14dCA35V7WfETCLT6+ArtRU4qsjop2YXyUzcLw3OuumBAoRsazgUKz8rkZJbifkSikbdxs+Hupcf2I
 15NOOuKStKoqouqCO/vmRi8u8g0KQhf2LcQBSqLk6OZ8TQuv07W5tVO2Ky5qCYu6aXBBlHhGSY9fGL
 16vqaYcxMcVJQpXUUL6nSWCoaLdaAAB+Anw1Tpbd47W7ieTK5Yq2IROPQIr1mk8nvFbxoTcBuIQ6oU
 17RiiLX+mb3hYgbTL3LqDmmm9FFI8enJu6pUxP8iKKROtCqhYXhF1i3EwReBzJzpDGZ+y4rJxb0Es4
 18sPVc/TaVPSJCTmgcKzwps7M12uxm8G9Dv3lKgZVmgDRivovCJFxHdCdgCYB08FvNWuFtXO+schsE
 19N0nY2i07A2joaJC18yvoNGZ+ySBTBPOBN+5XbiQs0vsQ4MfLETb2O2dFjwE/tErgo6RWYg2qQNAe
 20DSh2wHzI0YJM3PqaUR0Q9KnjEWc92hsLI34KnuNkNkVk4NEjPOetxeIBcYN7CDD6tTxp42sU++bT
 21o9zyjy1BPS+LuEblxDTSlVPb0dxvkwNBXBi0RXIOWfD15BWcV1Uv972jB6To1XPDIOc+eq7fa5yn
 22HRW/GYdGPmOYKietdw6V3t2Et9cPlw4v08IelucF06Ju2a73QtidtkA89vxjn7qOEVACAXpsiMsM
 234JCcAzF7jh0U2mskSB14I9HcZh1Sei0J2ZULcXNyuIw9nsWp8vrH04OOoUDe7/UpX7c8+A+tqDUy
 241W2V1dJDhlwu2SXL5jJFBK4P9p2e+XyHJ+AcYXrHQIKxqoCgvnywT4HnI2bvZ1+lmIR99mp1Cvzj
 25RUgJaqhI7u6WH3i6fmkA92hF8MP5WDYTGwjsHPrCg6Xkqykuvub4osu+gLq5t+JC9rOczgrRNYXg
 2654FMzlCyQxTfgY6IRwPH/xYHKGbViFF+jA4ksLMRjI2XOV4swbI232SxMoQQDNsjx1la2nZM3P5z
 27g7zpmaiyzY44q3kU1viMMR7qM/w1S6nTW0ZkzTXk8Gttor/0JWT1K8KgwK02B6Q9zNwfK60a0cQm
 28SbA/dXkWapuIzQLz+ZUPyG/1EP5KuKNnsp0hfVi8TTgOFceoV9kyIhrTQNI0o5O91dqkyWd/bMl2
 29OnrnRnhka6f839zJKUpWPTfRX9RMJTk/5HVcL/qsHYcJedZyPawJjMU+cxW1ZZjr1Lo6M0fjKuTI
 30Askg0ZKS0FJ60jTKnc1DmldQLtieHh1UTdty+yn1A0rGnrFEyN7if2/d1EduWJaf6bvWzfH+d/36
 311gDwp4OXi0qWu7c5zByGZi2j2sFo4v0cGgjPZUJvF5z0V8OkE15DiA4xtTSkIjCnEmOhODViwrfc
 32ONvHB+inBW9wLp26qFgNcYrYxP2FC54pPCxO+KJaAJrtfE3A4lkboB7V0xFu23ecOy4n2gho39tg
 33Bxkt1Xj3GCLgeKvcYLzOPytZldXDTtoCcsm5uhCmBHEmPUsnLc7Tt1cFflFtWTOjtyv0Lk8Qu2BU
 34B/hSSgjZRpqE+hzjtghjXdFOT5wKULvtUz5eu+lH7kjGghQbF962vLcRCsr+tMPba6MFqhy5Q+dM
 35NcHc+HIx2WiuRZ6jdCZSUpH3f1+kH6XYj2P3/F0kLBRAMPGKbXpIi9Px4AVDEDClL77mDpVgeEoh
 36kkVh5zvk2PsEPonmTFK0kQE8Q4cYFWTKa9lAE4Wc35EzvpKFdTwQKhr5kN7tEq17n5wJt/499164
 37ho0+LjzYy62JI/fv3RPISL0gXr2INLW7fgZ5KNjcnu/AITJu3ycw/XH8BKsx4dcbBgBdrKY8afEn
 38IZ1EIv/TuNvmifmAEGX/DWuVmZIOU6pTystzTQwfz0wko3lUKjkPM40RLN9o6lddV6fM3QNtK0ac
 39hqOOmG68LzI1U33nvUBol/FeEV0DLvGjvsIRC/TCtDu5Vk2tKS13p9kNj4owJK8d343PZ/eyi/Oe
 40sNZCCJJuj4iIodekm1hzj7zc6ZLNudgab/WkF7TbWDOhDPwG1gE/McffGNWPFlwsaopoZaH8E8tl
 41QSOnHqAiNa7B3ifxMrGDWHDlxkWddClbKd9ujL4mgB88Wo8JceLawDOcSVGImvWGxsrK2RX7FK57
 42GQYuc0zcq3NH4jpoOyS+vpMeigTPDOvQdqjGgEUW3aXdA8Ma0KYVEyAhK/rFXw8FelGREM2ku1kN
 43kziOTAe52SWqcrv6NUPfo1/Uc6u7KpwQrcDlFZWxPCKomeRQTm6AmP2QHMgl2gaUbmuBF/C9Ccl2
 441Iqh8vUdDT3lHdf5I5SjRPJJXX2/0/oUFmwIC5AFp8/XXnIG05BER1X2Y+SL15QHW7lYsvd4ZKTv
 45tvYaZNWajgAVZl8gJYFUQG+U+cFYcpHhf6SGzcuwcmQJGxptZAVnRtDzNjJ04vJB616/uoI2Qkp2
 46ysGAjDNlwgeckmU7TSYoYaML29pRupTTQqKItyFDuebUpSKBTxsEFIJBCTErA8TD8I9T5nzT+rTy
 47+Lpp9mqcxQR1RhxgTx5bE7D4igdblobX0IONARg4EIAk8xj1Ba3k4skdjAQcJOHKd+xVo+vsrIqg
 48a+ycemROE5F3D3s21ozMOn1Dy8iIeQusJQTSkP82+wHYWXRg59N0cq/40CaJskK+yp7afOWFoCqY
 49T/D9OGlfeIIiLivwMh8naPZyM4+pd/CFZwcWoGtIno04nWWR/xQVe17jqPMov1xonC2E3AcKxUXl
 50PMdZoOARkR+KHZnoBZ/vjqxeDPARKupijkw5QQI3jNmd5IELjcL8OraHlo+e884mRsa/66J7p94D
 51bidzjiVLUhCsZnVks9eZF6PIEg49eq/+w8ph3X7XBNnZYAbgola/0yy/PlPzgJ3p/AgXMoGr+HXO
 52p2WAs1WRo9mAdeOBMrAMvXKFD04bZPNHke0Ri03O5U7NRRs1T0LnqdZHyF39As8FiktfJl1bn/U0
 53sUjhc4fDNnDaBN8VF8VsEa7UolRC6NqQ1oHaeEZRoq0li6NbXIXdxIIT4bbqwajqFkvvO6qc6SEG
 54iAlUzTGB2zATBgkqhkiG9w0BCRUxBgQEAQAAADBXBgkqhkiG9w0BCRQxSh5IADcAOAA1ADAAZABj
 55ADAAYwAtAGIAZQBmAGIALQA0AGEANQBiAC0AOAA5ADcAMAAtAGIAZAA5ADkAOQAxADEAOQA2AGIA
 56YgA1MGsGCSsGAQQBgjcRATFeHlwATQBpAGMAcgBvAHMAbwBmAHQAIABFAG4AaABhAG4AYwBlAGQA
 57IABDAHIAeQBwAHQAbwBnAHIAYQBwAGgAaQBjACAAUAByAG8AdgBpAGQAZQByACAAdgAxAC4AMDCC
 58BUcGCSqGSIb3DQEHBqCCBTgwggU0AgEAMIIFLQYJKoZIhvcNAQcBMBwGCiqGSIb3DQEMAQMwDgQI
 59Amt1zAZpKWkCAgfQgIIFAJoBLiXPEZGuUfsyM2ed66sBIirBctHbhyydZsQDT8V2crq6AI3P0dBT
 60Agf/MouK/JcAfdGEEpU6SKxqZBDZoTRbyK7VdW5YiKGUurFGf66L9K3c4MHhVLMWnSkwK+0gwiIB
 61RB82Or4ru0cSQbF32vsuJgJY9Ax4YODKokPFUzZjPrmch4AgZWKxslDFDq4xs3tpLIeZbALWYdrR
 62PUZaReO+NaLfNKwTZsinzjPkCst7R1Jfjf1abikPrOMPgYFUiQL7GNQFbefeJu9SCXlj09u/qw+l
 63uLrwEyMamG0cgjrWbMOohGtvAuHqeZIIWuLnGE2quq7Ah/U55lliZn3IFgs1n6FalW/XGH0T0aRA
 64im6f1EgxtJShBNdG6qNrkzYMyY2Xvpk82qtmvMbhJMDstpovsdT1rZ6OGfsyJAlG94BcCWC2wuvW
 65MYs6H7AirBG/iocNm7JwSBQ7wjl0keH9vuHDQsI+uu9yWGuyZK6MmxDEOEMZRndU0GrlLIp7zQx8
 66gPeagKqSHhPK0ghHhDilMyToE3Euvi5jneh90eofWK6E4E8KtQTWvFeCe9fYRhMaflH9lwfHfXPo
 679J+7GZLRF/MDTlE8jzWoP5csUxV3jnXQkTUOfHvO7QK6POKwLGkCyZ5wKFydyYdTekG+KU2Vml2y
 68s6pZ+kME1VMYiHRF3CaXX1ZYKikEdnuB1Qp8BE2uKQTaYO4Wns0vQIVRWTrk/Gp5RXu1ihzoTiFb
 69YqLFROQTM+dVTUk3C6W82OroNwofW5ErZwpbdgJJ83gbPLr9W4KZ6YegvEWFT1MawnIYDC6RSKtg
 70fI1blSZOo1SIF6+nR0gFPivSEGBJHclIg7TtvGSB1q7TQFS4W5l+AHdgGPqqURnjuJ7/DVFZHqEV
 71jJM1QEvH/RY1rDXP8FZC6CZR/Le7tVm5o8bHnlU4gyStvNyLXHCP6o3gHmaBcfYmqJr/0ZEKnwnd
 72MBmdIgwQ3+JnKvjAeDe8Z/l0U03CbzeyN3TgUolDlUGVDF2FdPZqrVsLKw6VJv3hoFZmgEbb1fDq
 73Jblc82lrYIEW8E7ltRLDyNDmRdyaqkqw0e7SygXXxv6SKerxoJ5E1NyJdHeQXSahRrsj5UZpxlTE
 74ylb3upIF0F006w2D5J7xUDktPetVgM97dN3whbOrzWPPkn5CTZMaUdYGTYQK3/K/jQSKuXcaM04A
 75EWmcQOQ/5Quco/aMYWTTwFI9+bKZayZKHqQjNKuwss+iWTW2b26cA2XAr2XWCL9PEybVRK/5n4km
 765qkGIMjjczZxNy1+H1QoEOwkGVzQd390ktQajJBFcf9wBO+Ar14EgPKvdL4DRvCvXOK3CtrgbAq6
 77GK7uULRrz9t/5lu27ba5wcwxg6bFhgCsJsoSCJnLCR7H+QMB4LhnWA10U4hFWCamCKFoGkiXW6yV
 78OF4x+0D0MmrjrrAGi05KzfrsXNtRG0xbkmvrsjqzmsOKyjvtiBCrR0S6NUtKhyxoiz5bCCm+d8rm
 79jaPk9q01k52pjJAKYW0f+5+r15LamBecnjXtJ07LCl6cMA1Cj4L0mQUSefyFi666GC3TmhzHwhnj
 80SV64nTApS0gBsc6c18fUBsMcUj5nCNclIzfxwnARd/30yg22r09nUY2gtQTwk/W6VCpAH+7yZkH1
 81TLNGa+UmMnPsnBjlAJ6l9VPsa4uJM2DIQKtZXWq4DkhSAYKF6joIP7nKMDswHzAHBgUrDgMCGgQU
 82wTM1Z+CJZG9xAcf1zAVGl4ggYyYEFGBFyJ8VBwijS2zy1qwN1WYGtcWoAgIH0A==
 83";
 84
 85        public static X509Certificate2 GetX509Certificate2()
 086        {
 087            byte[] data = Convert.FromBase64String(Data);
 088            return new X509Certificate2(data);
 089        }
 90    }
 91}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\HttpsCertificate\PublicCertificateHelper.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_RegexMatcher.htm b/report/coverlet/WireMock.Net_RegexMatcher.htm index 4cf1e4f6..7238e409 100644 --- a/report/coverlet/WireMock.Net_RegexMatcher.htm +++ b/report/coverlet/WireMock.Net_RegexMatcher.htm @@ -20,7 +20,7 @@ Covered lines:38 Uncovered lines:3 Coverable lines:41 -Total lines:104 +Total lines:0 Line coverage:92.6% Branch coverage:100% @@ -39,116 +39,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\RegexMatcher.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using System.Linq;
 3using System.Text.RegularExpressions;
 4using JetBrains.Annotations;
 5using WireMock.Validation;
 6
 7namespace WireMock.Matchers
 8{
 9    /// <summary>
 10    /// Regular Expression Matcher
 11    /// </summary>
 12    /// <inheritdoc cref="IStringMatcher"/>
 13    /// <inheritdoc cref="IIgnoreCaseMatcher"/>
 14    public class RegexMatcher : IStringMatcher, IIgnoreCaseMatcher
 15    {
 16        private readonly string[] _patterns;
 17        private readonly Regex[] _expressions;
 18
 19        /// <inheritdoc cref="IMatcher.MatchBehaviour"/>
 37020        public MatchBehaviour MatchBehaviour { get; }
 21
 22        /// <summary>
 23        /// Initializes a new instance of the <see cref="RegexMatcher"/> class.
 24        /// </summary>
 25        /// <param name="pattern">The pattern.</param>
 26        /// <param name="ignoreCase">Ignore the case from the pattern.</param>
 827        public RegexMatcher([NotNull, RegexPattern] string pattern, bool ignoreCase = false) : this(new[] { pattern }, i
 828        {
 829        }
 30
 31        /// <summary>
 32        /// Initializes a new instance of the <see cref="RegexMatcher"/> class.
 33        /// </summary>
 34        /// <param name="matchBehaviour">The match behaviour.</param>
 35        /// <param name="pattern">The pattern.</param>
 36        /// <param name="ignoreCase">Ignore the case from the pattern.</param>
 9837        public RegexMatcher(MatchBehaviour matchBehaviour, [NotNull, RegexPattern] string pattern, bool ignoreCase = fal
 9838        {
 9839        }
 40
 41        /// <summary>
 42        /// Initializes a new instance of the <see cref="RegexMatcher"/> class.
 43        /// </summary>
 44        /// <param name="patterns">The patterns.</param>
 45        /// <param name="ignoreCase">Ignore the case from the pattern.</param>
 846        public RegexMatcher([NotNull, RegexPattern] string[] patterns, bool ignoreCase = false) : this(MatchBehaviour.Ac
 847        {
 848        }
 49
 50        /// <summary>
 51        /// Initializes a new instance of the <see cref="RegexMatcher"/> class.
 52        /// </summary>
 53        /// <param name="matchBehaviour">The match behaviour.</param>
 54        /// <param name="patterns">The patterns.</param>
 55        /// <param name="ignoreCase">Ignore the case from the pattern.</param>
 40756        public RegexMatcher(MatchBehaviour matchBehaviour, [NotNull, RegexPattern] string[] patterns, bool ignoreCase = 
 40857        {
 40858            Check.NotNull(patterns, nameof(patterns));
 59
 40860            _patterns = patterns;
 40861            IgnoreCase = ignoreCase;
 40762            MatchBehaviour = matchBehaviour;
 63
 40864            RegexOptions options = RegexOptions.Compiled;
 40865            if (ignoreCase)
 6466            {
 6467                options |= RegexOptions.IgnoreCase;
 6468            }
 69
 81870            _expressions = patterns.Select(p => new Regex(p, options)).ToArray();
 40771        }
 72
 73        /// <inheritdoc cref="IStringMatcher.IsMatch"/>
 74        public double IsMatch(string input)
 36875        {
 36876            double match = MatchScores.Mismatch;
 36877            if (input != null)
 36778            {
 79                try
 36780                {
 110381                    match = MatchScores.ToScore(_expressions.Select(e => e.IsMatch(input)));
 36782                }
 083                catch (Exception)
 084                {
 85                    // just ignore exception
 086                }
 36787            }
 88
 36889            return MatchBehaviourHelper.Convert(MatchBehaviour, match);
 36890        }
 91
 92        /// <inheritdoc cref="IStringMatcher.GetPatterns"/>
 93        public virtual string[] GetPatterns()
 394        {
 395            return _patterns;
 396        }
 97
 98        /// <inheritdoc cref="IMatcher.Name"/>
 299        public virtual string Name => "RegexMatcher";
 100
 101        /// <inheritdoc cref="IIgnoreCaseMatcher.IgnoreCase"/>
 3102        public bool IgnoreCase { get; }
 103    }
 104}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\RegexMatcher.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_RegexUtils.htm b/report/coverlet/WireMock.Net_RegexUtils.htm index 461f5ae9..c7dd4375 100644 --- a/report/coverlet/WireMock.Net_RegexUtils.htm +++ b/report/coverlet/WireMock.Net_RegexUtils.htm @@ -20,7 +20,7 @@ Covered lines:12 Uncovered lines:0 Coverable lines:12 -Total lines:24 +Total lines:0 Line coverage:100% Branch coverage:100% @@ -34,36 +34,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Util\RegexUtils.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System.Collections.Generic;
 2using System.Text.RegularExpressions;
 3
 4namespace WireMock.Util
 5{
 6    internal static class RegexUtils
 7    {
 8        public static Dictionary<string, string> GetNamedGroups(Regex regex, string input)
 39        {
 310            var namedGroupsDictionary = new Dictionary<string, string>();
 11
 312            GroupCollection groups = regex.Match(input).Groups;
 2713            foreach (string groupName in regex.GetGroupNames())
 914            {
 915                if (groups[groupName].Captures.Count > 0)
 316                {
 317                    namedGroupsDictionary.Add(groupName, groups[groupName].Value);
 318                }
 919            }
 20
 321            return namedGroupsDictionary;
 322        }
 23    }
 24}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Util\RegexUtils.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_Request.htm b/report/coverlet/WireMock.Net_Request.htm index 2c268bee..2418a9e1 100644 --- a/report/coverlet/WireMock.Net_Request.htm +++ b/report/coverlet/WireMock.Net_Request.htm @@ -20,7 +20,7 @@ Covered lines:208 Uncovered lines:6 Coverable lines:214 -Total lines:418 +Total lines:0 Line coverage:97.1% Branch coverage:100% @@ -82,430 +82,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\RequestBuilders\Request.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using System.Collections.ObjectModel;
 4using System.Linq;
 5using WireMock.Matchers;
 6using WireMock.Matchers.Request;
 7using WireMock.Util;
 8using WireMock.Validation;
 9
 10namespace WireMock.RequestBuilders
 11{
 12    /// <summary>
 13    /// The requests.
 14    /// </summary>
 15    public class Request : RequestMessageCompositeMatcher, IRequestBuilder
 16    {
 17        private readonly IList<IRequestMatcher> _requestMatchers;
 18
 19        /// <summary>
 20        /// Creates this instance.
 21        /// </summary>
 22        /// <returns>The <see cref="IRequestBuilder"/>.</returns>
 23        public static IRequestBuilder Create()
 31224        {
 31225            return new Request(new List<IRequestMatcher>());
 31226        }
 27
 28        /// <summary>
 29        /// Initializes a new instance of the <see cref="Request"/> class.
 30        /// </summary>
 31        /// <param name="requestMatchers">The request matchers.</param>
 31232        private Request(IList<IRequestMatcher> requestMatchers) : base(requestMatchers)
 31233        {
 31234            _requestMatchers = requestMatchers;
 31235        }
 36
 37        /// <summary>
 38        /// Gets the request message matchers.
 39        /// </summary>
 40        /// <typeparam name="T">Type of IRequestMatcher</typeparam>
 41        /// <returns>A List{T}</returns>
 42        public IList<T> GetRequestMessageMatchers<T>() where T : IRequestMatcher
 1243        {
 1844            return new ReadOnlyCollection<T>(_requestMatchers.Where(rm => rm is T).Cast<T>().ToList());
 1245        }
 46
 47        /// <summary>
 48        /// Gets the request message matcher.
 49        /// </summary>
 50        /// <typeparam name="T">Type of IRequestMatcher</typeparam>
 51        /// <returns>A RequestMatcher</returns>
 52        public T GetRequestMessageMatcher<T>() where T : IRequestMatcher
 453        {
 654            return _requestMatchers.Where(rm => rm is T).Cast<T>().FirstOrDefault();
 455        }
 56
 57        /// <inheritdoc cref="IClientIPRequestBuilder.WithClientIP(IStringMatcher[])"/>
 58        public IRequestBuilder WithClientIP(params IStringMatcher[] matchers)
 159        {
 160            Check.NotNullOrEmpty(matchers, nameof(matchers));
 61
 162            _requestMatchers.Add(new RequestMessageClientIPMatcher(matchers));
 163            return this;
 164        }
 65
 66        /// <inheritdoc cref="IClientIPRequestBuilder.WithClientIP(string[])"/>
 67        public IRequestBuilder WithClientIP(params string[] clientIPs)
 268        {
 269            return WithClientIP(MatchBehaviour.AcceptOnMatch, clientIPs);
 270        }
 71
 72        /// <inheritdoc cref="IClientIPRequestBuilder.WithClientIP(string[])"/>
 73        public IRequestBuilder WithClientIP(MatchBehaviour matchBehaviour, params string[] clientIPs)
 274        {
 275            Check.NotNullOrEmpty(clientIPs, nameof(clientIPs));
 76
 277            _requestMatchers.Add(new RequestMessageClientIPMatcher(matchBehaviour, clientIPs));
 278            return this;
 279        }
 80
 81        /// <inheritdoc cref="IClientIPRequestBuilder.WithClientIP(Func{string, bool}[])"/>
 82        public IRequestBuilder WithClientIP(params Func<string, bool>[] funcs)
 183        {
 184            Check.NotNullOrEmpty(funcs, nameof(funcs));
 85
 186            _requestMatchers.Add(new RequestMessageClientIPMatcher(funcs));
 187            return this;
 188        }
 89
 90        /// <inheritdoc cref="IUrlAndPathRequestBuilder.WithPath(IStringMatcher[])"/>
 91        public IRequestBuilder WithPath(params IStringMatcher[] matchers)
 6692        {
 6693            Check.NotNullOrEmpty(matchers, nameof(matchers));
 94
 6695            _requestMatchers.Add(new RequestMessagePathMatcher(matchers));
 6696            return this;
 6697        }
 98
 99        /// <inheritdoc cref="IUrlAndPathRequestBuilder.WithPath(string[])"/>
 100        public IRequestBuilder WithPath(params string[] paths)
 196101        {
 196102            return WithPath(MatchBehaviour.AcceptOnMatch, paths);
 197103        }
 104
 105        /// <inheritdoc cref="IUrlAndPathRequestBuilder.WithPath(MatchBehaviour, string[])"/>
 106        public IRequestBuilder WithPath(MatchBehaviour matchBehaviour, params string[] paths)
 197107        {
 197108            Check.NotNullOrEmpty(paths, nameof(paths));
 109
 196110            _requestMatchers.Add(new RequestMessagePathMatcher(matchBehaviour, paths));
 197111            return this;
 197112        }
 113
 114        /// <inheritdoc cref="IUrlAndPathRequestBuilder.WithPath(Func{string, bool}[])"/>
 115        public IRequestBuilder WithPath(params Func<string, bool>[] funcs)
 1116        {
 1117            Check.NotNullOrEmpty(funcs, nameof(funcs));
 118
 1119            _requestMatchers.Add(new RequestMessagePathMatcher(funcs));
 1120            return this;
 1121        }
 122
 123        /// <inheritdoc cref="IUrlAndPathRequestBuilder.WithUrl(IStringMatcher[])"/>
 124        public IRequestBuilder WithUrl(params IStringMatcher[] matchers)
 1125        {
 1126            Check.NotNullOrEmpty(matchers, nameof(matchers));
 127
 1128            _requestMatchers.Add(new RequestMessageUrlMatcher(matchers));
 1129            return this;
 1130        }
 131
 132        /// <inheritdoc cref="IUrlAndPathRequestBuilder.WithUrl(string[])"/>
 133        public IRequestBuilder WithUrl(params string[] urls)
 1134        {
 1135            return WithUrl(MatchBehaviour.AcceptOnMatch, urls);
 1136        }
 137
 138        /// <inheritdoc cref="IUrlAndPathRequestBuilder.WithUrl(MatchBehaviour, string[])"/>
 139        public IRequestBuilder WithUrl(MatchBehaviour matchBehaviour, params string[] urls)
 1140        {
 1141            Check.NotNullOrEmpty(urls, nameof(urls));
 142
 1143            _requestMatchers.Add(new RequestMessageUrlMatcher(matchBehaviour, urls));
 1144            return this;
 1145        }
 146
 147        /// <inheritdoc cref="IUrlAndPathRequestBuilder.WithUrl(Func{string, bool}[])"/>
 148        public IRequestBuilder WithUrl(params Func<string, bool>[] funcs)
 1149        {
 1150            Check.NotNullOrEmpty(funcs, nameof(funcs));
 151
 1152            _requestMatchers.Add(new RequestMessageUrlMatcher(funcs));
 1153            return this;
 1154        }
 155
 156        /// <inheritdoc cref="IMethodRequestBuilder.UsingDelete(MatchBehaviour)"/>
 157        public IRequestBuilder UsingDelete(MatchBehaviour matchBehaviour = MatchBehaviour.AcceptOnMatch)
 56158        {
 56159            _requestMatchers.Add(new RequestMessageMethodMatcher(matchBehaviour, "DELETE"));
 56160            return this;
 56161        }
 162
 163        /// <inheritdoc cref="IMethodRequestBuilder.UsingGet(MatchBehaviour)"/>
 164        public IRequestBuilder UsingGet(MatchBehaviour matchBehaviour = MatchBehaviour.AcceptOnMatch)
 91165        {
 91166            _requestMatchers.Add(new RequestMessageMethodMatcher(matchBehaviour, "GET"));
 91167            return this;
 91168        }
 169
 170        /// <inheritdoc cref="IMethodRequestBuilder.UsingHead(MatchBehaviour)"/>
 171        public IRequestBuilder UsingHead(MatchBehaviour matchBehaviour = MatchBehaviour.AcceptOnMatch)
 1172        {
 1173            _requestMatchers.Add(new RequestMessageMethodMatcher(matchBehaviour, "HEAD"));
 1174            return this;
 1175        }
 176
 177        /// <inheritdoc cref="IMethodRequestBuilder.UsingPost(MatchBehaviour)"/>
 178        public IRequestBuilder UsingPost(MatchBehaviour matchBehaviour = MatchBehaviour.AcceptOnMatch)
 68179        {
 68180            _requestMatchers.Add(new RequestMessageMethodMatcher(matchBehaviour, "POST"));
 68181            return this;
 68182        }
 183
 184        /// <inheritdoc cref="IMethodRequestBuilder.UsingPatch(MatchBehaviour)"/>
 185        public IRequestBuilder UsingPatch(MatchBehaviour matchBehaviour = MatchBehaviour.AcceptOnMatch)
 2186        {
 2187            _requestMatchers.Add(new RequestMessageMethodMatcher(matchBehaviour, "PATCH"));
 2188            return this;
 2189        }
 190
 191        /// <inheritdoc cref="IMethodRequestBuilder.UsingPut(MatchBehaviour)"/>
 192        public IRequestBuilder UsingPut(MatchBehaviour matchBehaviour = MatchBehaviour.AcceptOnMatch)
 14193        {
 14194            _requestMatchers.Add(new RequestMessageMethodMatcher(matchBehaviour, "PUT"));
 14195            return this;
 14196        }
 197
 198        /// <inheritdoc cref="IMethodRequestBuilder.UsingAnyMethod"/>
 199        public IRequestBuilder UsingAnyMethod()
 26200        {
 32201            var matchers = _requestMatchers.Where(m => m is RequestMessageMethodMatcher).ToList();
 80202            foreach (var matcher in matchers)
 1203            {
 1204                _requestMatchers.Remove(matcher);
 1205            }
 206
 26207            return this;
 26208        }
 209
 210        /// <inheritdoc cref="IMethodRequestBuilder.UsingAnyVerb"/>
 211        public IRequestBuilder UsingAnyVerb()
 0212        {
 0213            return UsingAnyMethod();
 0214        }
 215
 216        /// <inheritdoc cref="IMethodRequestBuilder.UsingMethod(string[])"/>
 217        public IRequestBuilder UsingMethod(params string[] methods)
 22218        {
 22219            return UsingMethod(MatchBehaviour.AcceptOnMatch, methods);
 22220        }
 221
 222        /// <inheritdoc cref="IMethodRequestBuilder.UsingVerb(string[])"/>
 223        public IRequestBuilder UsingVerb(params string[] verbs)
 0224        {
 0225            return UsingMethod(verbs);
 0226        }
 227
 228        /// <inheritdoc cref="IMethodRequestBuilder.UsingMethod(MatchBehaviour, string[])"/>
 229        public IRequestBuilder UsingMethod(MatchBehaviour matchBehaviour, params string[] methods)
 22230        {
 22231            Check.NotNullOrEmpty(methods, nameof(methods));
 232
 22233            _requestMatchers.Add(new RequestMessageMethodMatcher(matchBehaviour, methods));
 22234            return this;
 22235        }
 236
 237        /// <inheritdoc cref="IBodyRequestBuilder.WithBody(string, MatchBehaviour)"/>
 238        public IRequestBuilder WithBody(string body, MatchBehaviour matchBehaviour = MatchBehaviour.AcceptOnMatch)
 2239        {
 2240            _requestMatchers.Add(new RequestMessageBodyMatcher(matchBehaviour, body));
 2241            return this;
 2242        }
 243
 244        /// <inheritdoc cref="IBodyRequestBuilder.WithBody(byte[], MatchBehaviour)"/>
 245        public IRequestBuilder WithBody(byte[] body, MatchBehaviour matchBehaviour = MatchBehaviour.AcceptOnMatch)
 1246        {
 1247            _requestMatchers.Add(new RequestMessageBodyMatcher(matchBehaviour, body));
 1248            return this;
 1249        }
 250
 251        /// <inheritdoc cref="IBodyRequestBuilder.WithBody(object, MatchBehaviour)"/>
 252        public IRequestBuilder WithBody(object body, MatchBehaviour matchBehaviour = MatchBehaviour.AcceptOnMatch)
 1253        {
 1254            _requestMatchers.Add(new RequestMessageBodyMatcher(matchBehaviour, body));
 1255            return this;
 1256        }
 257
 258        /// <inheritdoc cref="IBodyRequestBuilder.WithBody(IMatcher)"/>
 259        public IRequestBuilder WithBody(IMatcher matcher)
 13260        {
 13261            Check.NotNull(matcher, nameof(matcher));
 262
 13263            _requestMatchers.Add(new RequestMessageBodyMatcher(matcher));
 13264            return this;
 13265        }
 266
 267        /// <inheritdoc cref="IBodyRequestBuilder.WithBody(Func{string, bool})"/>
 268        public IRequestBuilder WithBody(Func<string, bool> func)
 1269        {
 1270            Check.NotNull(func, nameof(func));
 271
 1272            _requestMatchers.Add(new RequestMessageBodyMatcher(func));
 1273            return this;
 1274        }
 275
 276        /// <inheritdoc cref="IBodyRequestBuilder.WithBody(Func{byte[], bool})"/>
 277        public IRequestBuilder WithBody(Func<byte[], bool> func)
 1278        {
 1279            Check.NotNull(func, nameof(func));
 280
 1281            _requestMatchers.Add(new RequestMessageBodyMatcher(func));
 1282            return this;
 1283        }
 284
 285        /// <inheritdoc cref="IBodyRequestBuilder.WithBody(Func{object, bool})"/>
 286        public IRequestBuilder WithBody(Func<object, bool> func)
 1287        {
 1288            Check.NotNull(func, nameof(func));
 289
 1290            _requestMatchers.Add(new RequestMessageBodyMatcher(func));
 1291            return this;
 1292        }
 293
 294        /// <inheritdoc cref="IParamsRequestBuilder.WithParam(string, MatchBehaviour)"/>
 295        public IRequestBuilder WithParam(string key, MatchBehaviour matchBehaviour = MatchBehaviour.AcceptOnMatch)
 1296        {
 1297            Check.NotNull(key, nameof(key));
 298
 1299            _requestMatchers.Add(new RequestMessageParamMatcher(matchBehaviour, key));
 1300            return this;
 1301        }
 302
 303        /// <inheritdoc cref="IParamsRequestBuilder.WithParam(string, string[])"/>
 304        public IRequestBuilder WithParam(string key, params string[] values)
 3305        {
 3306            return WithParam(key, MatchBehaviour.AcceptOnMatch, values);
 3307        }
 308
 309        /// <inheritdoc cref="IParamsRequestBuilder.WithParam(string, IStringMatcher[])"/>
 310        public IRequestBuilder WithParam(string key, params IStringMatcher[] matchers)
 1311        {
 1312            return WithParam(key, MatchBehaviour.AcceptOnMatch, matchers);
 1313        }
 314
 315        /// <inheritdoc cref="IParamsRequestBuilder.WithParam(string, MatchBehaviour, string[])"/>
 316        public IRequestBuilder WithParam(string key, MatchBehaviour matchBehaviour, params string[] values)
 3317        {
 3318            Check.NotNull(key, nameof(key));
 319
 3320            _requestMatchers.Add(new RequestMessageParamMatcher(matchBehaviour, key, values));
 3321            return this;
 3322        }
 323
 324        /// <inheritdoc cref="IParamsRequestBuilder.WithParam(string, MatchBehaviour, IStringMatcher[])"/>
 325        public IRequestBuilder WithParam(string key, MatchBehaviour matchBehaviour, params IStringMatcher[] matchers)
 2326        {
 2327            Check.NotNull(key, nameof(key));
 328
 2329            _requestMatchers.Add(new RequestMessageParamMatcher(matchBehaviour, key, matchers));
 2330            return this;
 2331        }
 332
 333        /// <inheritdoc cref="IParamsRequestBuilder.WithParam(Func{IDictionary{string, WireMockList{string}}, bool}[])"/
 334        public IRequestBuilder WithParam(params Func<IDictionary<string, WireMockList<string>>, bool>[] funcs)
 1335        {
 1336            Check.NotNullOrEmpty(funcs, nameof(funcs));
 337
 1338            _requestMatchers.Add(new RequestMessageParamMatcher(funcs));
 1339            return this;
 1340        }
 341
 342        /// <inheritdoc cref="IHeadersAndCookiesRequestBuilder.WithHeader(string, string, MatchBehaviour)"/>
 343        public IRequestBuilder WithHeader(string name, string pattern, MatchBehaviour matchBehaviour)
 1344        {
 1345            return WithHeader(name, pattern, true, matchBehaviour);
 1346        }
 347
 348        /// <inheritdoc cref="IHeadersAndCookiesRequestBuilder.WithHeader(string, string, bool, MatchBehaviour)"/>
 349        public IRequestBuilder WithHeader(string name, string pattern, bool ignoreCase = true, MatchBehaviour matchBehav
 39350        {
 39351            Check.NotNull(name, nameof(name));
 39352            Check.NotNull(pattern, nameof(pattern));
 353
 39354            _requestMatchers.Add(new RequestMessageHeaderMatcher(matchBehaviour, name, pattern, ignoreCase));
 39355            return this;
 39356        }
 357
 358        /// <inheritdoc cref="IHeadersAndCookiesRequestBuilder.WithHeader(string, string[], MatchBehaviour)"/>
 359        public IRequestBuilder WithHeader(string name, string[] patterns, MatchBehaviour matchBehaviour)
 1360        {
 1361            return WithHeader(name, patterns, true, matchBehaviour);
 1362        }
 363
 364        /// <inheritdoc cref="IHeadersAndCookiesRequestBuilder.WithHeader(string, string[], bool, MatchBehaviour)"/>
 365        public IRequestBuilder WithHeader(string name, string[] patterns, bool ignoreCase = true, MatchBehaviour matchBe
 2366        {
 2367            Check.NotNull(name, nameof(name));
 2368            Check.NotNull(patterns, nameof(patterns));
 369
 2370            _requestMatchers.Add(new RequestMessageHeaderMatcher(matchBehaviour, name, patterns, ignoreCase));
 2371            return this;
 2372        }
 373
 374        /// <inheritdoc cref="IHeadersAndCookiesRequestBuilder.WithHeader(string, IStringMatcher[])"/>
 375        public IRequestBuilder WithHeader(string name, params IStringMatcher[] matchers)
 1376        {
 1377            Check.NotNull(name, nameof(name));
 1378            Check.NotNullOrEmpty(matchers, nameof(matchers));
 379
 1380            _requestMatchers.Add(new RequestMessageHeaderMatcher(name, matchers));
 1381            return this;
 1382        }
 383
 384        /// <inheritdoc cref="IHeadersAndCookiesRequestBuilder.WithHeader(Func{IDictionary{string, string[]}, bool}[])"/
 385        public IRequestBuilder WithHeader(params Func<IDictionary<string, string[]>, bool>[] funcs)
 1386        {
 1387            Check.NotNullOrEmpty(funcs, nameof(funcs));
 388
 1389            _requestMatchers.Add(new RequestMessageHeaderMatcher(funcs));
 1390            return this;
 1391        }
 392
 393        /// <inheritdoc cref="IHeadersAndCookiesRequestBuilder.WithCookie(string, string, bool, MatchBehaviour)"/>
 394        public IRequestBuilder WithCookie(string name, string pattern, bool ignoreCase = true, MatchBehaviour matchBehav
 2395        {
 2396            _requestMatchers.Add(new RequestMessageCookieMatcher(matchBehaviour, name, pattern, ignoreCase));
 2397            return this;
 2398        }
 399
 400        /// <inheritdoc cref="IHeadersAndCookiesRequestBuilder.WithCookie(string, IStringMatcher[])"/>
 401        public IRequestBuilder WithCookie(string name, params IStringMatcher[] matchers)
 1402        {
 1403            Check.NotNullOrEmpty(matchers, nameof(matchers));
 404
 1405            _requestMatchers.Add(new RequestMessageCookieMatcher(name, matchers));
 1406            return this;
 1407        }
 408
 409        /// <inheritdoc cref="IHeadersAndCookiesRequestBuilder.WithCookie(Func{IDictionary{string, string}, bool}[])"/>
 410        public IRequestBuilder WithCookie(params Func<IDictionary<string, string>, bool>[] funcs)
 1411        {
 1412            Check.NotNullOrEmpty(funcs, nameof(funcs));
 413
 1414            _requestMatchers.Add(new RequestMessageCookieMatcher(funcs));
 1415            return this;
 1416        }
 417    }
 418}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\RequestBuilders\Request.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_RequestMatchResult.htm b/report/coverlet/WireMock.Net_RequestMatchResult.htm index e31d5c1b..df1c9419 100644 --- a/report/coverlet/WireMock.Net_RequestMatchResult.htm +++ b/report/coverlet/WireMock.Net_RequestMatchResult.htm @@ -20,7 +20,7 @@ Covered lines:16 Uncovered lines:0 Coverable lines:16 -Total lines:82 +Total lines:0 Line coverage:100% Branch coverage:50% @@ -36,94 +36,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\Request\RequestMatchResult.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3
 4namespace WireMock.Matchers.Request
 5{
 6    /// <summary>
 7    /// RequestMatchResult
 8    /// </summary>
 9    public class RequestMatchResult : IComparable
 10    {
 11        /// <summary>
 12        /// Gets or sets the match-score.
 13        /// </summary>
 14        /// <value>
 15        /// The match-score.
 16        /// </value>
 182217        public double TotalScore { get; private set; }
 18
 19        /// <summary>
 20        /// Gets or sets the total number of matches.
 21        /// </summary>
 22        /// <value>
 23        /// The total number of matches.
 24        /// </value>
 186325        public int TotalNumber { get; private set; }
 26
 27        /// <summary>
 28        /// Gets or sets a value indicating whether this instance is perfect match.
 29        /// </summary>
 30        /// <value>
 31        /// <c>true</c> if this instance is perfect match; otherwise, <c>false</c>.
 32        /// </value>
 31533        public bool IsPerfectMatch => Math.Abs(TotalScore - TotalNumber) < MatchScores.Tolerance;
 34
 35        /// <summary>
 36        /// Gets the match percentage.
 37        /// </summary>
 38        /// <value>
 39        /// The match percentage.
 40        /// </value>
 4041        public double AverageTotalScore => TotalNumber == 0 ? 0.0 : TotalScore / TotalNumber;
 42
 43        /// <summary>
 44        /// Gets the match details.
 45        /// </summary>
 75146        public IList<KeyValuePair<Type, double>> MatchDetails { get; }
 47
 48        /// <summary>
 49        /// Initializes a new instance of the <see cref="RequestMatchResult"/> class.
 50        /// </summary>
 73051        public RequestMatchResult() => MatchDetails = new List<KeyValuePair<Type, double>>();
 52
 53        /// <summary>
 54        /// Adds the score.
 55        /// </summary>
 56        /// <param name="matcherType">The matcher Type.</param>
 57        /// <param name="score">The score.</param>
 58        /// <returns>The score.</returns>
 59        public double AddScore(Type matcherType, double score)
 71660        {
 71661            TotalScore += score;
 71662            TotalNumber++;
 71663            MatchDetails.Add(new KeyValuePair<Type, double>(matcherType, score));
 64
 71665            return score;
 71666        }
 67
 68        /// <summary>
 69        /// Compares the current instance with another object of the same type and returns an integer that indicates whe
 70        /// </summary>
 71        /// <param name="obj">An object to compare with this instance.</param>
 72        /// <returns>
 73        /// A value that indicates the relative order of the objects being compared. The return value has these meanings
 74        /// </returns>
 75        public int CompareTo(object obj)
 176        {
 177            var compareObj = (RequestMatchResult)obj;
 78
 179            return compareObj.AverageTotalScore.CompareTo(AverageTotalScore);
 180        }
 81    }
 82}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\Request\RequestMatchResult.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_RequestMessage.htm b/report/coverlet/WireMock.Net_RequestMessage.htm index 6e078738..bd4eccdb 100644 --- a/report/coverlet/WireMock.Net_RequestMessage.htm +++ b/report/coverlet/WireMock.Net_RequestMessage.htm @@ -20,7 +20,7 @@ Covered lines:81 Uncovered lines:0 Coverable lines:81 -Total lines:212 +Total lines:0 Line coverage:100% Branch coverage:95.8% @@ -36,224 +36,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\RequestMessage.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using System.Linq;
 4using System.Text;
 5using System.Net;
 6using JetBrains.Annotations;
 7using WireMock.Models;
 8using WireMock.Util;
 9using WireMock.Validation;
 10
 11namespace WireMock
 12{
 13    /// <summary>
 14    /// The RequestMessage.
 15    /// </summary>
 16    public class RequestMessage
 17    {
 18        /// <summary>
 19        /// Gets the Client IP Address.
 20        /// </summary>
 6021        public string ClientIP { get; }
 22
 23        /// <summary>
 24        /// Gets the url (relative).
 25        /// </summary>
 6026        public string Url { get; }
 27
 28        /// <summary>
 29        /// Gets the AbsoluteUrl.
 30        /// </summary>
 5431        public string AbsoluteUrl { get; }
 32
 33        /// <summary>
 34        /// Gets the DateTime.
 35        /// </summary>
 10136        public DateTime DateTime { get; set; }
 37
 38        /// <summary>
 39        /// Gets the path (relative).
 40        /// </summary>
 61541        public string Path { get; }
 42
 43        /// <summary>
 44        /// Gets the AbsolutePath.
 45        /// </summary>
 25546        public string AbsolutePath { get; }
 47
 48        /// <summary>
 49        /// Gets the path segments.
 50        /// </summary>
 351        public string[] PathSegments { get; }
 52
 53        /// <summary>
 54        /// Gets the absolute path segments.
 55        /// </summary>
 156        public string[] AbsolutePathSegments { get; }
 57
 58        /// <summary>
 59        /// Gets the method.
 60        /// </summary>
 35061        public string Method { get; }
 62
 63        /// <summary>
 64        /// Gets the headers.
 65        /// </summary>
 18866        public IDictionary<string, WireMockList<string>> Headers { get; }
 67
 68        /// <summary>
 69        /// Gets the cookies.
 70        /// </summary>
 7471        public IDictionary<string, string> Cookies { get; }
 72
 73        /// <summary>
 74        /// Gets the query.
 75        /// </summary>
 10376        public IDictionary<string, WireMockList<string>> Query { get; }
 77
 78        /// <summary>
 79        /// Gets the raw query.
 80        /// </summary>
 20081        public string RawQuery { get; }
 82
 83        /// <summary>
 84        /// The original body as string, this is defined when Body or BodyAsJson are not null.
 85        /// </summary>
 10786        public string Body { get; }
 87
 88        /// <summary>
 89        /// The body (as JSON object).
 90        /// </summary>
 30091        public object BodyAsJson { get; set; }
 92
 93        /// <summary>
 94        /// The body (as bytearray).
 95        /// </summary>
 27096        public byte[] BodyAsBytes { get; set; }
 97
 98        /// <summary>
 99        /// Gets the Host
 100        /// </summary>
 201101        public string Host { get; }
 102
 103        /// <summary>
 104        /// Gets the protocol
 105        /// </summary>
 201106        public string Protocol { get; }
 107
 108        /// <summary>
 109        /// Gets the port
 110        /// </summary>
 201111        public int Port { get; }
 112
 113        /// <summary>
 114        /// Gets the origin
 115        /// </summary>
 1116        public string Origin { get; }
 117
 118        /// <summary>
 119        /// The body encoding.
 120        /// </summary>
 87121        public Encoding BodyEncoding { get; }
 122
 123        /// <summary>
 124        /// Initializes a new instance of the <see cref="RequestMessage"/> class.
 125        /// </summary>
 126        /// <param name="urlDetails">The original url details.</param>
 127        /// <param name="method">The HTTP method.</param>
 128        /// <param name="clientIP">The client IP Address.</param>
 129        /// <param name="body">The body.</param>
 130        /// <param name="headers">The headers.</param>
 131        /// <param name="cookies">The cookies.</param>
 200132        public RequestMessage([NotNull] UrlDetails urlDetails, [NotNull] string method, [NotNull] string clientIP, [CanB
 200133        {
 200134            Check.NotNull(urlDetails, nameof(urlDetails));
 200135            Check.NotNull(method, nameof(method));
 200136            Check.NotNull(clientIP, nameof(clientIP));
 137
 200138            AbsoluteUrl = urlDetails.AbsoluteUrl.ToString();
 200139            Url = urlDetails.Url.ToString();
 200140            Protocol = urlDetails.Url.Scheme;
 200141            Host = urlDetails.Url.Host;
 200142            Port = urlDetails.Url.Port;
 200143            Origin = $"{Protocol}://{Host}:{Port}";
 144
 200145            AbsolutePath = WebUtility.UrlDecode(urlDetails.AbsoluteUrl.AbsolutePath);
 200146            Path = WebUtility.UrlDecode(urlDetails.Url.AbsolutePath);
 200147            PathSegments = Path.Split('/').Skip(1).ToArray();
 200148            AbsolutePathSegments = AbsolutePath.Split('/').Skip(1).ToArray();
 149
 200150            Method = method;
 200151            ClientIP = clientIP;
 152
 200153            Body = body?.BodyAsString;
 200154            BodyEncoding = body?.Encoding;
 200155            BodyAsJson = body?.BodyAsJson;
 200156            BodyAsBytes = body?.BodyAsBytes;
 157
 366158            Headers = headers?.ToDictionary(header => header.Key, header => new WireMockList<string>(header.Value));
 200159            Cookies = cookies;
 200160            RawQuery = WebUtility.UrlDecode(urlDetails.Url.Query);
 200161            Query = ParseQuery(RawQuery);
 200162        }
 163
 164        private static IDictionary<string, WireMockList<string>> ParseQuery(string queryString)
 200165        {
 200166            if (string.IsNullOrEmpty(queryString))
 187167            {
 187168                return null;
 169            }
 170
 13171            if (queryString.StartsWith("?"))
 13172            {
 13173                queryString = queryString.Substring(1);
 13174            }
 175
 13176            return queryString.Split(new[] { '&' }, StringSplitOptions.RemoveEmptyEntries)
 13177                .Aggregate(new Dictionary<string, WireMockList<string>>(),
 13178                (dict, term) =>
 33179                {
 33180                    string[] parts = term.Split(new[] { '=' }, StringSplitOptions.RemoveEmptyEntries);
 33181                    string key = parts[0];
 33182                    if (!dict.ContainsKey(key))
 28183                    {
 28184                        dict.Add(key, new WireMockList<string>());
 28185                    }
 13186
 33187                    if (parts.Length == 2)
 30188                    {
 30189                        string[] values = parts[1].Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
 30190                        dict[key].AddRange(values);
 30191                    }
 13192
 33193                    return dict;
 33194                });
 200195        }
 196
 197        /// <summary>
 198        /// Get a query parameter.
 199        /// </summary>
 200        /// <param name="key">The key.</param>
 201        /// <returns>The query parameter.</returns>
 202        public WireMockList<string> GetParameter(string key)
 16203        {
 16204            if (Query == null)
 2205            {
 2206                return null;
 207            }
 208
 14209            return Query.ContainsKey(key) ? Query[key] : null;
 16210        }
 211    }
 212}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\RequestMessage.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_RequestMessageBodyMatcher.htm b/report/coverlet/WireMock.Net_RequestMessageBodyMatcher.htm index 8c84285c..56d6ffff 100644 --- a/report/coverlet/WireMock.Net_RequestMessageBodyMatcher.htm +++ b/report/coverlet/WireMock.Net_RequestMessageBodyMatcher.htm @@ -20,7 +20,7 @@ Covered lines:67 Uncovered lines:0 Coverable lines:67 -Total lines:158 +Total lines:0 Line coverage:100% Branch coverage:88.4% @@ -42,170 +42,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\Request\RequestMessageBodyMatcher.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using JetBrains.Annotations;
 3using WireMock.Validation;
 4
 5namespace WireMock.Matchers.Request
 6{
 7    /// <summary>
 8    /// The request body matcher.
 9    /// </summary>
 10    public class RequestMessageBodyMatcher : IRequestMatcher
 11    {
 12        /// <summary>
 13        /// The body function
 14        /// </summary>
 615        public Func<string, bool> Func { get; }
 16
 17        /// <summary>
 18        /// The body data function for byte[]
 19        /// </summary>
 520        public Func<byte[], bool> DataFunc { get; }
 21
 22        /// <summary>
 23        /// The body data function for json
 24        /// </summary>
 425        public Func<object, bool> JsonFunc { get; }
 26
 27        /// <summary>
 28        /// The matcher.
 29        /// </summary>
 3830        public IMatcher Matcher { get; }
 31
 32        /// <summary>
 33        /// Initializes a new instance of the <see cref="RequestMessageBodyMatcher"/> class.
 34        /// </summary>
 35        /// <param name="matchBehaviour">The match behaviour.</param>
 36        /// <param name="body">The body.</param>
 237        public RequestMessageBodyMatcher(MatchBehaviour matchBehaviour, [NotNull] string body) : this(new WildcardMatche
 238        {
 239        }
 40
 41        /// <summary>
 42        /// Initializes a new instance of the <see cref="RequestMessageBodyMatcher"/> class.
 43        /// </summary>
 44        /// <param name="matchBehaviour">The match behaviour.</param>
 45        /// <param name="body">The body.</param>
 146        public RequestMessageBodyMatcher(MatchBehaviour matchBehaviour, [NotNull] byte[] body) : this(new ExactObjectMat
 147        {
 148        }
 49
 50        /// <summary>
 51        /// Initializes a new instance of the <see cref="RequestMessageBodyMatcher"/> class.
 52        /// </summary>
 53        /// <param name="matchBehaviour">The match behaviour.</param>
 54        /// <param name="body">The body.</param>
 155        public RequestMessageBodyMatcher(MatchBehaviour matchBehaviour, [NotNull] object body) : this(new ExactObjectMat
 156        {
 157        }
 58
 59        /// <summary>
 60        /// Initializes a new instance of the <see cref="RequestMessageBodyMatcher"/> class.
 61        /// </summary>
 62        /// <param name="func">The function.</param>
 163        public RequestMessageBodyMatcher([NotNull] Func<string, bool> func)
 164        {
 165            Check.NotNull(func, nameof(func));
 166            Func = func;
 167        }
 68
 69        /// <summary>
 70        /// Initializes a new instance of the <see cref="RequestMessageBodyMatcher"/> class.
 71        /// </summary>
 72        /// <param name="func">The function.</param>
 173        public RequestMessageBodyMatcher([NotNull] Func<byte[], bool> func)
 174        {
 175            Check.NotNull(func, nameof(func));
 176            DataFunc = func;
 177        }
 78
 79        /// <summary>
 80        /// Initializes a new instance of the <see cref="RequestMessageBodyMatcher"/> class.
 81        /// </summary>
 82        /// <param name="func">The function.</param>
 183        public RequestMessageBodyMatcher([NotNull] Func<object, bool> func)
 184        {
 185            Check.NotNull(func, nameof(func));
 186            JsonFunc = func;
 187        }
 88
 89        /// <summary>
 90        /// Initializes a new instance of the <see cref="RequestMessageBodyMatcher"/> class.
 91        /// </summary>
 92        /// <param name="matcher">The matcher.</param>
 2393        public RequestMessageBodyMatcher([NotNull] IMatcher matcher)
 2394        {
 2395            Check.NotNull(matcher, nameof(matcher));
 2396            Matcher = matcher;
 2397        }
 98
 99        /// <see cref="IRequestMatcher.GetMatchingScore"/>
 100        public double GetMatchingScore(RequestMessage requestMessage, RequestMatchResult requestMatchResult)
 22101        {
 22102            double score = IsMatch(requestMessage);
 22103            return requestMatchResult.AddScore(GetType(), score);
 22104        }
 105
 106        private double IsMatch(RequestMessage requestMessage)
 22107        {
 108            // Check if the matcher is a IObjectMatcher
 22109            if (Matcher is IObjectMatcher objectMatcher)
 9110            {
 111                // If the body is a JSON object, try to match.
 9112                if (requestMessage.BodyAsJson != null)
 5113                {
 5114                    return objectMatcher.IsMatch(requestMessage.BodyAsJson);
 115                }
 116
 117                // If the body is a byte array, try to match.
 4118                if (requestMessage.BodyAsBytes != null)
 2119                {
 2120                    return objectMatcher.IsMatch(requestMessage.BodyAsBytes);
 121                }
 2122            }
 123
 124            // Check if the matcher is a IStringMatcher
 15125            if (Matcher is IStringMatcher stringMatcher)
 12126            {
 127                // If the  body is a JSON object, try to use Body (string) to match.
 12128                if (requestMessage.BodyAsJson != null && requestMessage.Body != null)
 1129                {
 1130                    return stringMatcher.IsMatch(requestMessage.Body);
 131                }
 132
 133                // If the string body is defined, try to match.
 11134                if (requestMessage.Body != null)
 9135                {
 9136                    return stringMatcher.IsMatch(requestMessage.Body);
 137                }
 2138            }
 139
 5140            if (Func != null)
 1141            {
 1142                return MatchScores.ToScore(requestMessage.Body != null && Func(requestMessage.Body));
 143            }
 144
 4145            if (DataFunc != null)
 1146            {
 1147                return MatchScores.ToScore(requestMessage.BodyAsBytes != null && DataFunc(requestMessage.BodyAsBytes));
 148            }
 149
 3150            if (JsonFunc != null)
 1151            {
 1152                return MatchScores.ToScore(requestMessage.BodyAsJson != null && JsonFunc(requestMessage.BodyAsJson));
 153            }
 154
 2155            return MatchScores.Mismatch;
 22156        }
 157    }
 158}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\Request\RequestMessageBodyMatcher.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_RequestMessageClientIPMatcher.htm b/report/coverlet/WireMock.Net_RequestMessageClientIPMatcher.htm index 5c13d8da..24e48ebb 100644 --- a/report/coverlet/WireMock.Net_RequestMessageClientIPMatcher.htm +++ b/report/coverlet/WireMock.Net_RequestMessageClientIPMatcher.htm @@ -20,7 +20,7 @@ Covered lines:27 Uncovered lines:1 Coverable lines:28 -Total lines:75 +Total lines:0 Line coverage:96.4% Branch coverage:66.6% @@ -38,87 +38,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\Request\RequestMessageClientIPMatcher.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using System.Linq;
 4using JetBrains.Annotations;
 5using WireMock.Validation;
 6
 7namespace WireMock.Matchers.Request
 8{
 9    /// <summary>
 10    /// The request ClientIP matcher.
 11    /// </summary>
 12    public class RequestMessageClientIPMatcher : IRequestMatcher
 13    {
 14        /// <summary>
 15        /// The matchers.
 16        /// </summary>
 717        public IReadOnlyList<IStringMatcher> Matchers { get; }
 18
 19        /// <summary>
 20        /// The ClientIP functions.
 21        /// </summary>
 222        public Func<string, bool>[] Funcs { get; }
 23
 24        /// <summary>
 25        /// Initializes a new instance of the <see cref="RequestMessageClientIPMatcher"/> class.
 26        /// </summary>
 27        /// <param name="clientIPs">The clientIPs.</param>
 28        /// <param name="matchBehaviour">The match behaviour.</param>
 529        public RequestMessageClientIPMatcher(MatchBehaviour matchBehaviour, [NotNull] params string[] clientIPs) : this(
 230        {
 231        }
 32
 33        /// <summary>
 34        /// Initializes a new instance of the <see cref="RequestMessageClientIPMatcher"/> class.
 35        /// </summary>
 36        /// <param name="matchers">The matchers.</param>
 337        public RequestMessageClientIPMatcher([NotNull] params IStringMatcher[] matchers)
 338        {
 339            Check.NotNull(matchers, nameof(matchers));
 340            Matchers = matchers;
 341        }
 42
 43        /// <summary>
 44        /// Initializes a new instance of the <see cref="RequestMessageClientIPMatcher"/> class.
 45        /// </summary>
 46        /// <param name="funcs">The clientIP functions.</param>
 147        public RequestMessageClientIPMatcher([NotNull] params Func<string, bool>[] funcs)
 148        {
 149            Check.NotNull(funcs, nameof(funcs));
 150            Funcs = funcs;
 151        }
 52
 53        /// <inheritdoc cref="IRequestMatcher.GetMatchingScore"/>
 54        public double GetMatchingScore(RequestMessage requestMessage, RequestMatchResult requestMatchResult)
 455        {
 456            double score = IsMatch(requestMessage);
 457            return requestMatchResult.AddScore(GetType(), score);
 458        }
 59
 60        private double IsMatch(RequestMessage requestMessage)
 461        {
 462            if (Matchers != null)
 363            {
 764                return Matchers.Max(matcher => matcher.IsMatch(requestMessage.ClientIP));
 65            }
 66
 167            if (Funcs != null)
 168            {
 269                return MatchScores.ToScore(requestMessage.ClientIP != null && Funcs.Any(func => func(requestMessage.Clie
 70            }
 71
 072            return MatchScores.Mismatch;
 473        }
 74    }
 75}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\Request\RequestMessageClientIPMatcher.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_RequestMessageCompositeMatcher.htm b/report/coverlet/WireMock.Net_RequestMessageCompositeMatcher.htm index 5d436d7f..36b8f716 100644 --- a/report/coverlet/WireMock.Net_RequestMessageCompositeMatcher.htm +++ b/report/coverlet/WireMock.Net_RequestMessageCompositeMatcher.htm @@ -20,7 +20,7 @@ Covered lines:16 Uncovered lines:0 Coverable lines:16 -Total lines:52 +Total lines:0 Line coverage:100% Branch coverage:100% @@ -35,64 +35,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\Request\RequestMessageCompositeMatcher.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System.Collections.Generic;
 2using System.Linq;
 3using JetBrains.Annotations;
 4using WireMock.Validation;
 5
 6namespace WireMock.Matchers.Request
 7{
 8    /// <summary>
 9    /// The composite request matcher.
 10    /// </summary>
 11    public abstract class RequestMessageCompositeMatcher : IRequestMatcher
 12    {
 13        private readonly CompositeMatcherType _type;
 14
 15        /// <summary>
 16        /// Gets the request matchers.
 17        /// </summary>
 18        /// <value>
 19        /// The request matchers.
 20        /// </value>
 65721        private IEnumerable<IRequestMatcher> RequestMatchers { get; }
 22
 23        /// <summary>
 24        /// Initializes a new instance of the <see cref="RequestMessageCompositeMatcher"/> class.
 25        /// </summary>
 26        /// <param name="requestMatchers">The request matchers.</param>
 27        /// <param name="type">The CompositeMatcherType type (Defaults to 'And')</param>
 31428        protected RequestMessageCompositeMatcher([NotNull] IEnumerable<IRequestMatcher> requestMatchers, CompositeMatche
 31429        {
 31430            Check.NotNull(requestMatchers, nameof(requestMatchers));
 31
 31532            _type = type;
 31533            RequestMatchers = requestMatchers;
 31534        }
 35
 36        /// <inheritdoc cref="IRequestMatcher.GetMatchingScore"/>
 37        public double GetMatchingScore(RequestMessage requestMessage, RequestMatchResult requestMatchResult)
 32938        {
 32939            if (!RequestMatchers.Any())
 140            {
 141                return MatchScores.Mismatch;
 42            }
 43
 32844            if (_type == CompositeMatcherType.And)
 32745            {
 97846                return RequestMatchers.Average(requestMatcher => requestMatcher.GetMatchingScore(requestMessage, request
 47            }
 48
 349            return RequestMatchers.Max(requestMatcher => requestMatcher.GetMatchingScore(requestMessage, requestMatchRes
 32950        }
 51    }
 52}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\Request\RequestMessageCompositeMatcher.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_RequestMessageCookieMatcher.htm b/report/coverlet/WireMock.Net_RequestMessageCookieMatcher.htm index c01793ef..ce935577 100644 --- a/report/coverlet/WireMock.Net_RequestMessageCookieMatcher.htm +++ b/report/coverlet/WireMock.Net_RequestMessageCookieMatcher.htm @@ -20,7 +20,7 @@ Covered lines:43 Uncovered lines:2 Coverable lines:45 -Total lines:111 +Total lines:0 Line coverage:95.5% Branch coverage:90% @@ -38,123 +38,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\Request\RequestMessageCookieMatcher.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using System.Linq;
 4using JetBrains.Annotations;
 5using WireMock.Validation;
 6
 7namespace WireMock.Matchers.Request
 8{
 9    /// <summary>
 10    /// The request cookie matcher.
 11    /// </summary>
 12    public class RequestMessageCookieMatcher : IRequestMatcher
 13    {
 14        private readonly MatchBehaviour _matchBehaviour;
 15        private readonly bool _ignoreCase;
 16
 17        /// <value>
 18        /// The funcs.
 19        /// </value>
 1020        public Func<IDictionary<string, string>, bool>[] Funcs { get; }
 21
 22        /// <summary>
 23        /// The name
 24        /// </summary>
 1425        public string Name { get; }
 26
 27        /// <value>
 28        /// The matchers.
 29        /// </value>
 1430        public IStringMatcher[] Matchers { get; }
 31
 32        /// <summary>
 33        /// Initializes a new instance of the <see cref="RequestMessageCookieMatcher"/> class.
 34        /// </summary>
 35        /// <param name="matchBehaviour">The match behaviour.</param>
 36        /// <param name="name">The name.</param>
 37        /// <param name="pattern">The pattern.</param>
 38        /// <param name="ignoreCase">The ignoreCase.</param>
 1039        public RequestMessageCookieMatcher(MatchBehaviour matchBehaviour, [NotNull] string name, [NotNull] string patter
 1040        {
 1041            Check.NotNull(name, nameof(name));
 1042            Check.NotNull(pattern, nameof(pattern));
 43
 1044            _matchBehaviour = matchBehaviour;
 1045            _ignoreCase = ignoreCase;
 1046            Name = name;
 1047            Matchers = new IStringMatcher[] { new WildcardMatcher(matchBehaviour, pattern, ignoreCase) };
 1048        }
 49
 50        /// <summary>
 51        /// Initializes a new instance of the <see cref="RequestMessageCookieMatcher"/> class.
 52        /// </summary>
 53        /// <param name="name">The name.</param>
 54        /// <param name="matchers">The matchers.</param>
 255        public RequestMessageCookieMatcher([NotNull] string name, [NotNull] params IStringMatcher[] matchers)
 256        {
 257            Check.NotNull(name, nameof(name));
 258            Check.NotNull(matchers, nameof(matchers));
 59
 260            Name = name;
 261            Matchers = matchers;
 262        }
 63
 64        /// <summary>
 65        /// Initializes a new instance of the <see cref="RequestMessageCookieMatcher"/> class.
 66        /// </summary>
 67        /// <param name="funcs">The funcs.</param>
 268        public RequestMessageCookieMatcher([NotNull] params Func<IDictionary<string, string>, bool>[] funcs)
 269        {
 270            Check.NotNull(funcs, nameof(funcs));
 71
 272            Funcs = funcs;
 273        }
 74
 75        /// <inheritdoc cref="IRequestMatcher.GetMatchingScore"/>
 76        public double GetMatchingScore(RequestMessage requestMessage, RequestMatchResult requestMatchResult)
 1177        {
 1178            double score = IsMatch(requestMessage);
 1179            return requestMatchResult.AddScore(GetType(), score);
 1180        }
 81
 82        private double IsMatch(RequestMessage requestMessage)
 1183        {
 1184            if (requestMessage.Cookies == null)
 285            {
 286                return MatchBehaviourHelper.Convert(_matchBehaviour, MatchScores.Mismatch);
 87            }
 88
 89            // Check if we want to use IgnoreCase to compare the Cookie-Name and Cookie-Value
 990            var cookies = !_ignoreCase ? requestMessage.Cookies : new Dictionary<string, string>(requestMessage.Cookies,
 91
 992            if (Funcs != null)
 193            {
 294                return MatchScores.ToScore(Funcs.Any(f => f(cookies)));
 95            }
 96
 897            if (Matchers == null)
 098            {
 099                return MatchScores.Mismatch;
 100            }
 101
 8102            if (!cookies.ContainsKey(Name))
 2103            {
 2104                return MatchBehaviourHelper.Convert(_matchBehaviour, MatchScores.Mismatch);
 105            }
 106
 6107            string value = cookies[Name];
 12108            return Matchers.Max(m => m.IsMatch(value));
 11109        }
 110    }
 111}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\Request\RequestMessageCookieMatcher.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_RequestMessageHeaderMatcher.htm b/report/coverlet/WireMock.Net_RequestMessageHeaderMatcher.htm index 0db7c718..f8f2a9c7 100644 --- a/report/coverlet/WireMock.Net_RequestMessageHeaderMatcher.htm +++ b/report/coverlet/WireMock.Net_RequestMessageHeaderMatcher.htm @@ -20,7 +20,7 @@ Covered lines:52 Uncovered lines:2 Coverable lines:54 -Total lines:131 +Total lines:0 Line coverage:96.2% Branch coverage:90% @@ -39,143 +39,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\Request\RequestMessageHeaderMatcher.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using System.Linq;
 4using JetBrains.Annotations;
 5using WireMock.Util;
 6using WireMock.Validation;
 7
 8namespace WireMock.Matchers.Request
 9{
 10    /// <summary>
 11    /// The request header matcher.
 12    /// </summary>
 13    /// <inheritdoc cref="IRequestMatcher"/>
 14    public class RequestMessageHeaderMatcher : IRequestMatcher
 15    {
 16        private readonly MatchBehaviour _matchBehaviour;
 17        private readonly bool _ignoreCase;
 18
 19        /// <summary>
 20        /// The functions
 21        /// </summary>
 4922        public Func<IDictionary<string, string[]>, bool>[] Funcs { get; }
 23
 24        /// <summary>
 25        /// The name
 26        /// </summary>
 7427        public string Name { get; }
 28
 29        /// <value>
 30        /// The matchers.
 31        /// </value>
 7432        public IStringMatcher[] Matchers { get; }
 33
 34        /// <summary>
 35        /// Initializes a new instance of the <see cref="RequestMessageHeaderMatcher"/> class.
 36        /// </summary>
 37        /// <param name="name">The name.</param>
 38        /// <param name="pattern">The pattern.</param>
 39        /// <param name="ignoreCase">Ignore the case from the pattern.</param>
 40        /// <param name="matchBehaviour">The match behaviour.</param>
 4741        public RequestMessageHeaderMatcher(MatchBehaviour matchBehaviour, [NotNull] string name, [NotNull] string patter
 4742        {
 4743            Check.NotNull(name, nameof(name));
 4744            Check.NotNull(pattern, nameof(pattern));
 45
 4746            _matchBehaviour = matchBehaviour;
 4747            _ignoreCase = ignoreCase;
 4748            Name = name;
 4749            Matchers = new IStringMatcher[] { new WildcardMatcher(matchBehaviour, pattern, ignoreCase) };
 4750        }
 51
 52        /// <summary>
 53        /// Initializes a new instance of the <see cref="RequestMessageHeaderMatcher"/> class.
 54        /// </summary>
 55        /// <param name="name">The name.</param>
 56        /// <param name="patterns">The patterns.</param>
 57        /// <param name="ignoreCase">Ignore the case from the pattern.</param>
 58        /// <param name="matchBehaviour">The match behaviour.</param>
 259        public RequestMessageHeaderMatcher(MatchBehaviour matchBehaviour, [NotNull] string name, [NotNull] string[] patt
 260        {
 261            Check.NotNull(name, nameof(name));
 262            Check.NotNull(patterns, nameof(patterns));
 63
 264            _matchBehaviour = matchBehaviour;
 265            _ignoreCase = ignoreCase;
 266            Name = name;
 667            Matchers = patterns.Select(pattern => new WildcardMatcher(matchBehaviour, pattern, ignoreCase)).Cast<IString
 268        }
 69
 70        /// <summary>
 71        /// Initializes a new instance of the <see cref="RequestMessageHeaderMatcher"/> class.
 72        /// </summary>
 73        /// <param name="name">The name.</param>
 74        /// <param name="matchers">The matchers.</param>
 275        public RequestMessageHeaderMatcher([NotNull] string name, [NotNull] params IStringMatcher[] matchers)
 276        {
 277            Check.NotNull(name, nameof(name));
 278            Check.NotNull(matchers, nameof(matchers));
 79
 280            Name = name;
 281            Matchers = matchers;
 282        }
 83
 84        /// <summary>
 85        /// Initializes a new instance of the <see cref="RequestMessageHeaderMatcher"/> class.
 86        /// </summary>
 87        /// <param name="funcs">The funcs.</param>
 288        public RequestMessageHeaderMatcher([NotNull] params Func<IDictionary<string, string[]>, bool>[] funcs)
 289        {
 290            Check.NotNull(funcs, nameof(funcs));
 91
 292            Funcs = funcs;
 293        }
 94
 95        /// <inheritdoc cref="IRequestMatcher.GetMatchingScore"/>
 96        public double GetMatchingScore(RequestMessage requestMessage, RequestMatchResult requestMatchResult)
 5097        {
 5098            double score = IsMatch(requestMessage);
 5099            return requestMatchResult.AddScore(GetType(), score);
 50100        }
 101
 102        private double IsMatch(RequestMessage requestMessage)
 50103        {
 50104            if (requestMessage.Headers == null)
 2105            {
 2106                return MatchBehaviourHelper.Convert(_matchBehaviour, MatchScores.Mismatch);
 107            }
 108
 109            // Check if we want to use IgnoreCase to compare the Header-Name and Header-Value(s)
 48110            var headers = !_ignoreCase ? requestMessage.Headers : new Dictionary<string, WireMockList<string>>(requestMe
 111
 48112            if (Funcs != null)
 1113            {
 4114                return MatchScores.ToScore(Funcs.Any(f => f(headers.ToDictionary(entry => entry.Key, entry => entry.Valu
 115            }
 116
 47117            if (Matchers == null)
 0118            {
 0119                return MatchScores.Mismatch;
 120            }
 121
 47122            if (!headers.ContainsKey(Name))
 20123            {
 20124                return MatchBehaviourHelper.Convert(_matchBehaviour, MatchScores.Mismatch);
 125            }
 126
 27127            WireMockList<string> list = headers[Name];
 81128            return Matchers.Max(m => list.Max(value => m.IsMatch(value))); // TODO : is this correct ?
 50129        }
 130    }
 131}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\Request\RequestMessageHeaderMatcher.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_RequestMessageMethodMatcher.htm b/report/coverlet/WireMock.Net_RequestMessageMethodMatcher.htm index a284940e..cde79742 100644 --- a/report/coverlet/WireMock.Net_RequestMessageMethodMatcher.htm +++ b/report/coverlet/WireMock.Net_RequestMessageMethodMatcher.htm @@ -20,7 +20,7 @@ Covered lines:14 Uncovered lines:0 Coverable lines:14 -Total lines:45 +Total lines:0 Line coverage:100% @@ -35,57 +35,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\Request\RequestMessageMethodMatcher.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using System.Linq;
 3using JetBrains.Annotations;
 4using WireMock.Validation;
 5
 6namespace WireMock.Matchers.Request
 7{
 8    /// <summary>
 9    /// The request verb matcher.
 10    /// </summary>
 11    internal class RequestMessageMethodMatcher : IRequestMatcher
 12    {
 13        private readonly MatchBehaviour _matchBehaviour;
 14
 15        /// <summary>
 16        /// The methods
 17        /// </summary>
 28718        public string[] Methods { get; }
 19
 20        /// <summary>
 21        /// Initializes a new instance of the <see cref="RequestMessageMethodMatcher"/> class.
 22        /// </summary>
 23        /// <param name="matchBehaviour">The match behaviour.</param>
 24        /// <param name="methods">The methods.</param>
 25425        public RequestMessageMethodMatcher(MatchBehaviour matchBehaviour, [NotNull] params string[] methods)
 25426        {
 25427            Check.NotNull(methods, nameof(methods));
 25428            _matchBehaviour = matchBehaviour;
 29
 25430            Methods = methods;
 25431        }
 32
 33        /// <inheritdoc cref="IRequestMatcher.GetMatchingScore"/>
 34        public double GetMatchingScore(RequestMessage requestMessage, RequestMatchResult requestMatchResult)
 28635        {
 28636            double score = MatchBehaviourHelper.Convert(_matchBehaviour, IsMatch(requestMessage));
 28637            return requestMatchResult.AddScore(GetType(), score);
 28638        }
 39
 40        private double IsMatch(RequestMessage requestMessage)
 28641        {
 28642            return MatchScores.ToScore(Methods.Contains(requestMessage.Method, StringComparer.OrdinalIgnoreCase));
 28643        }
 44    }
 45}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\Request\RequestMessageMethodMatcher.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_RequestMessageParamMatcher.htm b/report/coverlet/WireMock.Net_RequestMessageParamMatcher.htm index 27de1bc4..840a12fc 100644 --- a/report/coverlet/WireMock.Net_RequestMessageParamMatcher.htm +++ b/report/coverlet/WireMock.Net_RequestMessageParamMatcher.htm @@ -20,7 +20,7 @@ Covered lines:46 Uncovered lines:1 Coverable lines:47 -Total lines:120 +Total lines:0 Line coverage:97.8% Branch coverage:85% @@ -39,132 +39,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\Request\RequestMessageParamMatcher.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using System.Linq;
 4using JetBrains.Annotations;
 5using WireMock.Util;
 6using WireMock.Validation;
 7
 8namespace WireMock.Matchers.Request
 9{
 10    /// <summary>
 11    /// The request parameters matcher.
 12    /// </summary>
 13    public class RequestMessageParamMatcher : IRequestMatcher
 14    {
 15        private readonly MatchBehaviour _matchBehaviour;
 16
 17        /// <summary>
 18        /// The funcs
 19        /// </summary>
 1120        public Func<IDictionary<string, WireMockList<string>>, bool>[] Funcs { get; }
 21
 22        /// <summary>
 23        /// The key
 24        /// </summary>
 925        public string Key { get; }
 26
 27        /// <summary>
 28        /// The matchers.
 29        /// </summary>
 2630        public IReadOnlyList<IStringMatcher> Matchers { get; }
 31
 32        /// <summary>
 33        /// Initializes a new instance of the <see cref="RequestMessageParamMatcher"/> class.
 34        /// </summary>
 35        /// <param name="matchBehaviour">The match behaviour.</param>
 36        /// <param name="key">The key.</param>
 337        public RequestMessageParamMatcher(MatchBehaviour matchBehaviour, [NotNull] string key) : this(matchBehaviour, ke
 338        {
 339        }
 40
 41        /// <summary>
 42        /// Initializes a new instance of the <see cref="RequestMessageParamMatcher"/> class.
 43        /// </summary>
 44        /// <param name="matchBehaviour">The match behaviour.</param>
 45        /// <param name="key">The key.</param>
 46        /// <param name="values">The values.</param>
 1847        public RequestMessageParamMatcher(MatchBehaviour matchBehaviour, [NotNull] string key, [CanBeNull] string[] valu
 748        {
 749        }
 50
 51        /// <summary>
 52        /// Initializes a new instance of the <see cref="RequestMessageParamMatcher"/> class.
 53        /// </summary>
 54        /// <param name="matchBehaviour">The match behaviour.</param>
 55        /// <param name="key">The key.</param>
 56        /// <param name="matchers">The matchers.</param>
 1357        public RequestMessageParamMatcher(MatchBehaviour matchBehaviour, [NotNull] string key, [CanBeNull] IStringMatche
 1358        {
 1359            Check.NotNull(key, nameof(key));
 60
 1361            _matchBehaviour = matchBehaviour;
 1362            Key = key;
 1363            Matchers = matchers;
 1364        }
 65
 66        /// <summary>
 67        /// Initializes a new instance of the <see cref="RequestMessageParamMatcher"/> class.
 68        /// </summary>
 69        /// <param name="funcs">The funcs.</param>
 170        public RequestMessageParamMatcher([NotNull] params Func<IDictionary<string, WireMockList<string>>, bool>[] funcs
 171        {
 172            Check.NotNull(funcs, nameof(funcs));
 73
 174            Funcs = funcs;
 175        }
 76
 77        /// <inheritdoc cref="IRequestMatcher.GetMatchingScore"/>
 78        public double GetMatchingScore(RequestMessage requestMessage, RequestMatchResult requestMatchResult)
 1079        {
 1080            double score = MatchBehaviourHelper.Convert(_matchBehaviour, IsMatch(requestMessage));
 1081            return requestMatchResult.AddScore(GetType(), score);
 1082        }
 83
 84        private double IsMatch(RequestMessage requestMessage)
 1085        {
 1086            if (Funcs != null)
 187            {
 288                return MatchScores.ToScore(requestMessage.Query != null && Funcs.Any(f => f(requestMessage.Query)));
 89            }
 90
 991            WireMockList<string> valuesPresentInRequestMessage = requestMessage.GetParameter(Key);
 992            if (valuesPresentInRequestMessage == null)
 193            {
 94                // Key is not present at all, just return Mismatch
 195                return MatchScores.Mismatch;
 96            }
 97
 898            if (Matchers != null && Matchers.Any())
 599            {
 100                // Matchers are defined, just use the matchers to calculate the match score.
 5101                var scores = new List<double>();
 31102                foreach (string valuePresentInRequestMessage in valuesPresentInRequestMessage)
 8103                {
 24104                    double score = Matchers.Max(m => m.IsMatch(valuePresentInRequestMessage));
 8105                    scores.Add(score);
 8106                }
 107
 5108                return scores.Any() ? scores.Average() : MatchScores.Mismatch;
 109            }
 110
 3111            if (Matchers == null || !Matchers.Any())
 3112            {
 113                // Matchers are null or not defined, and Key is present, just return Perfect.
 3114                return MatchScores.Perfect;
 115            }
 116
 0117            return MatchScores.Mismatch;
 10118        }
 119    }
 120}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\Request\RequestMessageParamMatcher.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_RequestMessagePathMatcher.htm b/report/coverlet/WireMock.Net_RequestMessagePathMatcher.htm index ffec1923..03ac8cf8 100644 --- a/report/coverlet/WireMock.Net_RequestMessagePathMatcher.htm +++ b/report/coverlet/WireMock.Net_RequestMessagePathMatcher.htm @@ -20,7 +20,7 @@ Covered lines:27 Uncovered lines:1 Coverable lines:28 -Total lines:77 +Total lines:0 Line coverage:96.4% Branch coverage:66.6% @@ -38,89 +38,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\Request\RequestMessagePathMatcher.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using System.Linq;
 4using JetBrains.Annotations;
 5using WireMock.Validation;
 6
 7namespace WireMock.Matchers.Request
 8{
 9    /// <summary>
 10    /// The request path matcher.
 11    /// </summary>
 12    public class RequestMessagePathMatcher : IRequestMatcher
 13    {
 14        /// <summary>
 15        /// The matchers
 16        /// </summary>
 59317        public IReadOnlyList<IStringMatcher> Matchers { get; }
 18
 19        /// <summary>
 20        /// The path functions
 21        /// </summary>
 222        public Func<string, bool>[] Funcs { get; }
 23
 24        /// <summary>
 25        /// Initializes a new instance of the <see cref="RequestMessagePathMatcher"/> class.
 26        /// </summary>
 27        /// <param name="matchBehaviour">The match behaviour.</param>
 28        /// <param name="paths">The paths.</param>
 39229        public RequestMessagePathMatcher(MatchBehaviour matchBehaviour, [NotNull] params string[] paths) : this(paths.Se
 19630        {
 19631        }
 32
 33        /// <summary>
 34        /// Initializes a new instance of the <see cref="RequestMessagePathMatcher"/> class.
 35        /// </summary>
 36        /// <param name="matchers">The matchers.</param>
 26237        public RequestMessagePathMatcher([NotNull] params IStringMatcher[] matchers)
 26238        {
 26239            Check.NotNull(matchers, nameof(matchers));
 40
 26241            Matchers = matchers;
 26242        }
 43
 44        /// <summary>
 45        /// Initializes a new instance of the <see cref="RequestMessagePathMatcher"/> class.
 46        /// </summary>
 47        /// <param name="funcs">The path functions.</param>
 148        public RequestMessagePathMatcher([NotNull] params Func<string, bool>[] funcs)
 149        {
 150            Check.NotNull(funcs, nameof(funcs));
 51
 152            Funcs = funcs;
 153        }
 54
 55        /// <inheritdoc cref="IRequestMatcher.GetMatchingScore"/>
 56        public double GetMatchingScore(RequestMessage requestMessage, RequestMatchResult requestMatchResult)
 29657        {
 29658            double score = IsMatch(requestMessage);
 29659            return requestMatchResult.AddScore(GetType(), score);
 29660        }
 61
 62        private double IsMatch(RequestMessage requestMessage)
 29663        {
 29664            if (Matchers != null)
 29565            {
 59266                return Matchers.Max(m => m.IsMatch(requestMessage.Path));
 67            }
 68
 169            if (Funcs != null)
 170            {
 271                return MatchScores.ToScore(requestMessage.Path != null && Funcs.Any(func => func(requestMessage.Path)));
 72            }
 73
 074            return MatchScores.Mismatch;
 29675        }
 76    }
 77}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\Request\RequestMessagePathMatcher.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_RequestMessageScenarioAndStateMatcher.htm b/report/coverlet/WireMock.Net_RequestMessageScenarioAndStateMatcher.htm index 42cd1a39..63ff5dc4 100644 --- a/report/coverlet/WireMock.Net_RequestMessageScenarioAndStateMatcher.htm +++ b/report/coverlet/WireMock.Net_RequestMessageScenarioAndStateMatcher.htm @@ -20,7 +20,7 @@ Covered lines:12 Uncovered lines:0 Coverable lines:12 -Total lines:46 +Total lines:0 Line coverage:100% Branch coverage:100% @@ -36,58 +36,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\Request\RequestMessageScenarioAndStateMatcher.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using JetBrains.Annotations;
 2
 3namespace WireMock.Matchers.Request
 4{
 5    /// <summary>
 6    /// The scenario and state matcher.
 7    /// </summary>
 8    internal class RequestMessageScenarioAndStateMatcher : IRequestMatcher
 9    {
 10        /// <summary>
 11        /// Execution state condition for the current mapping.
 12        /// </summary>
 13        [CanBeNull]
 14        private readonly string _executionConditionState;
 15
 16        /// <summary>
 17        /// The next state which will be signaled after the current mapping execution.
 18        /// In case the value is null state will not be changed.
 19        /// </summary>
 20        [CanBeNull]
 21        private readonly string _nextState;
 22
 23        /// <summary>
 24        /// Initializes a new instance of the <see cref="RequestMessageScenarioAndStateMatcher"/> class.
 25        /// </summary>
 26        /// <param name="nextState">The next state.</param>
 27        /// <param name="executionConditionState">Execution state condition for the current mapping.</param>
 3028        public RequestMessageScenarioAndStateMatcher([CanBeNull] string nextState, [CanBeNull] string executionCondition
 3029        {
 3030            _nextState = nextState;
 3031            _executionConditionState = executionConditionState;
 3032        }
 33
 34        /// <inheritdoc />
 35        public double GetMatchingScore(RequestMessage requestMessage, RequestMatchResult requestMatchResult)
 3036        {
 3037            double score = IsMatch();
 3038            return requestMatchResult.AddScore(GetType(), score);
 3039        }
 40
 41        private double IsMatch()
 3042        {
 3043            return Equals(_executionConditionState, _nextState) ? MatchScores.Perfect : MatchScores.Mismatch;
 3044        }
 45    }
 46}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\Request\RequestMessageScenarioAndStateMatcher.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_RequestMessageUrlMatcher.htm b/report/coverlet/WireMock.Net_RequestMessageUrlMatcher.htm index e33139ab..d0e0efb3 100644 --- a/report/coverlet/WireMock.Net_RequestMessageUrlMatcher.htm +++ b/report/coverlet/WireMock.Net_RequestMessageUrlMatcher.htm @@ -20,7 +20,7 @@ Covered lines:27 Uncovered lines:1 Coverable lines:28 -Total lines:75 +Total lines:0 Line coverage:96.4% Branch coverage:66.6% @@ -38,87 +38,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\Request\RequestMessageUrlMatcher.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using System.Linq;
 4using JetBrains.Annotations;
 5using WireMock.Validation;
 6
 7namespace WireMock.Matchers.Request
 8{
 9    /// <summary>
 10    /// The request url matcher.
 11    /// </summary>
 12    public class RequestMessageUrlMatcher : IRequestMatcher
 13    {
 14        /// <summary>
 15        /// The matchers.
 16        /// </summary>
 517        public IReadOnlyList<IStringMatcher> Matchers { get; }
 18
 19        /// <summary>
 20        /// The url functions.
 21        /// </summary>
 222        public Func<string, bool>[] Funcs { get; }
 23
 24        /// <summary>
 25        /// Initializes a new instance of the <see cref="RequestMessageUrlMatcher"/> class.
 26        /// </summary>
 27        /// <param name="matchBehaviour">The match behaviour.</param>
 28        /// <param name="urls">The urls.</param>
 229        public RequestMessageUrlMatcher(MatchBehaviour matchBehaviour, [NotNull] params string[] urls) : this(urls.Selec
 130        {
 131        }
 32
 33        /// <summary>
 34        /// Initializes a new instance of the <see cref="RequestMessageUrlMatcher"/> class.
 35        /// </summary>
 36        /// <param name="matchers">The matchers.</param>
 237        public RequestMessageUrlMatcher([NotNull] params IStringMatcher[] matchers)
 238        {
 239            Check.NotNull(matchers, nameof(matchers));
 240            Matchers = matchers;
 241        }
 42
 43        /// <summary>
 44        /// Initializes a new instance of the <see cref="RequestMessageUrlMatcher"/> class.
 45        /// </summary>
 46        /// <param name="funcs">The url functions.</param>
 147        public RequestMessageUrlMatcher([NotNull] params Func<string, bool>[] funcs)
 148        {
 149            Check.NotNull(funcs, nameof(funcs));
 150            Funcs = funcs;
 151        }
 52
 53        /// <inheritdoc cref="IRequestMatcher.GetMatchingScore"/>
 54        public double GetMatchingScore(RequestMessage requestMessage, RequestMatchResult requestMatchResult)
 355        {
 356            double score = IsMatch(requestMessage);
 357            return requestMatchResult.AddScore(GetType(), score);
 358        }
 59
 60        private double IsMatch(RequestMessage requestMessage)
 361        {
 362            if (Matchers != null)
 263            {
 464                return Matchers.Max(matcher => matcher.IsMatch(requestMessage.Url));
 65            }
 66
 167            if (Funcs != null)
 168            {
 269                return MatchScores.ToScore(requestMessage.Url != null && Funcs.Any(func => func(requestMessage.Url)));
 70            }
 71
 072            return MatchScores.Mismatch;
 373        }
 74    }
 75}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\Request\RequestMessageUrlMatcher.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_RequestModel.htm b/report/coverlet/WireMock.Net_RequestModel.htm index daa66a56..72e50c0a 100644 --- a/report/coverlet/WireMock.Net_RequestModel.htm +++ b/report/coverlet/WireMock.Net_RequestModel.htm @@ -20,68 +20,14 @@ Covered lines:8 Uncovered lines:0 Coverable lines:8 -Total lines:50 +Total lines:0 Line coverage:100%

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Admin\Mappings\RequestModel.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System.Collections.Generic;
 2
 3namespace WireMock.Admin.Mappings
 4{
 5    /// <summary>
 6    /// RequestModel
 7    /// </summary>
 8    public class RequestModel
 9    {
 10        /// <summary>
 11        /// Gets or sets the ClientIP. (Can be a string or a ClientIPModel)
 12        /// </summary>
 1913        public object ClientIP { get; set; }
 14
 15        /// <summary>
 16        /// Gets or sets the Path. (Can be a string or a PathModel)
 17        /// </summary>
 6118        public object Path { get; set; }
 19
 20        /// <summary>
 21        /// Gets or sets the Url. (Can be a string or a UrlModel)
 22        /// </summary>
 823        public object Url { get; set; }
 24
 25        /// <summary>
 26        /// The methods
 27        /// </summary>
 5228        public string[] Methods { get; set; }
 29
 30        /// <summary>
 31        /// Gets or sets the Headers.
 32        /// </summary>
 1933        public IList<HeaderModel> Headers { get; set; }
 34
 35        /// <summary>
 36        /// Gets or sets the Cookies.
 37        /// </summary>
 1938        public IList<CookieModel> Cookies { get; set; }
 39
 40        /// <summary>
 41        /// Gets or sets the Params.
 42        /// </summary>
 1943        public IList<ParamModel> Params { get; set; }
 44
 45        /// <summary>
 46        /// Gets or sets the body.
 47        /// </summary>
 3448        public BodyModel Body { get; set; }
 49    }
 50}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Admin\Mappings\RequestModel.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_RespondWithAProvider.htm b/report/coverlet/WireMock.Net_RespondWithAProvider.htm index 393377a2..c9f37cff 100644 --- a/report/coverlet/WireMock.Net_RespondWithAProvider.htm +++ b/report/coverlet/WireMock.Net_RespondWithAProvider.htm @@ -20,7 +20,7 @@ Covered lines:42 Uncovered lines:4 Coverable lines:46 -Total lines:115 +Total lines:0 Line coverage:91.3% Branch coverage:50% @@ -43,127 +43,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Server\RespondWithAProvider.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using WireMock.Matchers.Request;
 3using WireMock.ResponseProviders;
 4
 5namespace WireMock.Server
 6{
 7    /// <summary>
 8    /// The respond with a provider.
 9    /// </summary>
 10    internal class RespondWithAProvider : IRespondWithAProvider
 11    {
 12        private int _priority;
 13        private string _title;
 14        private string _path;
 15        private string _executionConditionState;
 16        private string _nextState;
 17        private string _scenario;
 18        private readonly RegistrationCallback _registrationCallback;
 19        private readonly IRequestMatcher _requestMatcher;
 20
 52221        public Guid Guid { get; private set; } = Guid.NewGuid();
 22
 23        /// <summary>
 24        /// Initializes a new instance of the <see cref="RespondWithAProvider"/> class.
 25        /// </summary>
 26        /// <param name="registrationCallback">The registration callback.</param>
 27        /// <param name="requestMatcher">The request matcher.</param>
 24928        public RespondWithAProvider(RegistrationCallback registrationCallback, IRequestMatcher requestMatcher)
 24929        {
 24930            _registrationCallback = registrationCallback;
 24931            _requestMatcher = requestMatcher;
 24932        }
 33
 34        /// <summary>
 35        /// The respond with.
 36        /// </summary>
 37        /// <param name="provider">The provider.</param>
 38        public void RespondWith(IResponseProvider provider)
 24939        {
 24940            _registrationCallback(new Mapping(Guid, _title, _path, _requestMatcher, provider, _priority, _scenario, _exe
 24941        }
 42
 43        /// <see cref="IRespondWithAProvider.WithGuid(string)"/>
 44        public IRespondWithAProvider WithGuid(string guid)
 245        {
 246            return WithGuid(Guid.Parse(guid));
 247        }
 48
 49        /// <see cref="IRespondWithAProvider.WithGuid(Guid)"/>
 50        public IRespondWithAProvider WithGuid(Guid guid)
 1451        {
 1452            Guid = guid;
 53
 1454            return this;
 1455        }
 56
 57        /// <see cref="IRespondWithAProvider.WithTitle"/>
 58        public IRespondWithAProvider WithTitle(string title)
 459        {
 460            _title = title;
 61
 462            return this;
 463        }
 64
 65        /// <see cref="IRespondWithAProvider.WithPath"/>
 66        public IRespondWithAProvider WithPath(string path)
 1067        {
 1068            _path = path;
 69
 1070            return this;
 1071        }
 72
 73        /// <see cref="IRespondWithAProvider.AtPriority"/>
 74        public IRespondWithAProvider AtPriority(int priority)
 22175        {
 22176            _priority = priority;
 77
 22178            return this;
 22179        }
 80
 81        /// <see cref="IRespondWithAProvider.InScenario(string)"/>
 82        public IRespondWithAProvider InScenario(string scenario)
 1083        {
 1084            _scenario = scenario;
 85
 1086            return this;
 1087        }
 88
 89        /// <see cref="IRespondWithAProvider.WhenStateIs"/>
 90        public IRespondWithAProvider WhenStateIs(string state)
 691        {
 692            if (string.IsNullOrEmpty(_scenario))
 093            {
 094                throw new NotSupportedException("Unable to set state condition when no scenario is defined.");
 95            }
 96
 697            _executionConditionState = state;
 98
 699            return this;
 6100        }
 101
 102        /// <see cref="IRespondWithAProvider.WillSetStateTo"/>
 103        public IRespondWithAProvider WillSetStateTo(string state)
 5104        {
 5105            if (string.IsNullOrEmpty(_scenario))
 0106            {
 0107                throw new NotSupportedException("Unable to set next state when no scenario is defined.");
 108            }
 109
 5110            _nextState = state;
 111
 5112            return this;
 5113        }
 114    }
 115}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Server\RespondWithAProvider.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_Response.htm b/report/coverlet/WireMock.Net_Response.htm index 132c73ef..d84a460f 100644 --- a/report/coverlet/WireMock.Net_Response.htm +++ b/report/coverlet/WireMock.Net_Response.htm @@ -20,7 +20,7 @@ Covered lines:161 Uncovered lines:31 Coverable lines:192 -Total lines:414 +Total lines:0 Line coverage:83.8% Branch coverage:84.7% @@ -59,426 +59,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\ResponseBuilders\Response.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using System.IO;
 4using System.Linq;
 5using System.Net;
 6using System.Net.Http;
 7using System.Text;
 8using System.Threading.Tasks;
 9using JetBrains.Annotations;
 10using Newtonsoft.Json;
 11using WireMock.Http;
 12using WireMock.Settings;
 13using WireMock.Transformers;
 14using WireMock.Util;
 15using WireMock.Validation;
 16
 17namespace WireMock.ResponseBuilders
 18{
 19    /// <summary>
 20    /// The Response.
 21    /// </summary>
 22    public class Response : IResponseBuilder
 23    {
 24        private HttpClient _httpClientForProxy;
 25
 26        /// <summary>
 27        /// The delay
 28        /// </summary>
 8029        public TimeSpan? Delay { get; private set; }
 30
 31        /// <summary>
 32        /// Gets a value indicating whether [use transformer].
 33        /// </summary>
 10834        public bool UseTransformer { get; private set; }
 35
 36        /// <summary>
 37        /// The Proxy URL to use.
 38        /// </summary>
 7639        public string ProxyUrl { get; private set; }
 40
 41        /// <summary>
 42        /// The client X509Certificate2 Thumbprint or SubjectName to use.
 43        /// </summary>
 044        public string ClientX509Certificate2ThumbprintOrSubjectName { get; private set; }
 45
 46        /// <summary>
 47        /// Gets the response message.
 48        /// </summary>
 55049        public ResponseMessage ResponseMessage { get; }
 50
 51        /// <summary>
 52        /// A delegate to execute to generate the response.
 53        /// </summary>
 8054        public Func<RequestMessage, ResponseMessage> Callback { get; private set; }
 55
 56        /// <summary>
 57        /// Defines if the method WithCallback(...) is used.
 58        /// </summary>
 459        public bool WithCallbackUsed { get; private set; }
 60
 61        /// <summary>
 62        /// Creates this instance.
 63        /// </summary>
 64        /// <param name="responseMessage">ResponseMessage</param>
 65        /// <returns>A <see cref="IResponseBuilder"/>.</returns>
 66        [PublicAPI]
 67        public static IResponseBuilder Create([CanBeNull] ResponseMessage responseMessage = null)
 8768        {
 8769            var message = responseMessage ?? new ResponseMessage { StatusCode = (int)HttpStatusCode.OK };
 8770            return new Response(message);
 8771        }
 72
 73        /// <summary>
 74        /// Creates this instance with the specified function.
 75        /// </summary>
 76        /// <param name="func">The callback function.</param>
 77        /// <returns>A <see cref="IResponseBuilder"/>.</returns>
 78        [PublicAPI]
 79        public static IResponseBuilder Create([NotNull] Func<ResponseMessage> func)
 180        {
 181            Check.NotNull(func, nameof(func));
 82
 183            return new Response(func());
 184        }
 85
 86        /// <summary>
 87        /// Initializes a new instance of the <see cref="Response"/> class.
 88        /// </summary>
 89        /// <param name="responseMessage">
 90        /// The response.
 91        /// </param>
 8892        private Response(ResponseMessage responseMessage)
 8893        {
 8894            ResponseMessage = responseMessage;
 8895        }
 96
 97        /// <summary>
 98        /// The with status code.
 99        /// </summary>
 100        /// <param name="code">The code.</param>
 101        /// <returns>A <see cref="IResponseBuilder"/>.</returns>\
 102        [PublicAPI]
 103        public IResponseBuilder WithStatusCode(int code)
 22104        {
 22105            ResponseMessage.StatusCode = code;
 22106            return this;
 22107        }
 108
 109        /// <summary>
 110        /// The with status code.
 111        /// </summary>
 112        /// <param name="code">The code.</param>
 113        /// <returns>A <see cref="IResponseBuilder"/>.</returns>
 114        [PublicAPI]
 115        public IResponseBuilder WithStatusCode(HttpStatusCode code)
 0116        {
 0117            return WithStatusCode((int)code);
 0118        }
 119
 120        /// <summary>
 121        /// The with Success status code (200).
 122        /// </summary>
 123        /// <returns>A <see cref="IResponseBuilder"/>.</returns>
 124        [PublicAPI]
 125        public IResponseBuilder WithSuccess()
 1126        {
 1127            return WithStatusCode((int)HttpStatusCode.OK);
 1128        }
 129
 130        /// <summary>
 131        /// The with NotFound status code (404).
 132        /// </summary>
 133        /// <returns>The <see cref="IResponseBuilder"/>.</returns>
 134        [PublicAPI]
 135        public IResponseBuilder WithNotFound()
 0136        {
 0137            return WithStatusCode((int)HttpStatusCode.NotFound);
 0138        }
 139
 140        /// <inheritdoc cref="IHeadersResponseBuilder.WithHeader(string, string[])"/>
 141        public IResponseBuilder WithHeader(string name, params string[] values)
 102142        {
 102143            Check.NotNull(name, nameof(name));
 144
 102145            ResponseMessage.AddHeader(name, values);
 102146            return this;
 102147        }
 148
 149        /// <inheritdoc cref="IHeadersResponseBuilder.WithHeaders(IDictionary{string, string})"/>
 150        public IResponseBuilder WithHeaders(IDictionary<string, string> headers)
 1151        {
 1152            Check.NotNull(headers, nameof(headers));
 153
 3154            ResponseMessage.Headers = headers.ToDictionary(header => header.Key, header => new WireMockList<string>(head
 1155            return this;
 1156        }
 157
 158        /// <inheritdoc cref="IHeadersResponseBuilder.WithHeaders(IDictionary{string, string[]})"/>
 159        public IResponseBuilder WithHeaders(IDictionary<string, string[]> headers)
 1160        {
 1161            Check.NotNull(headers, nameof(headers));
 162
 3163            ResponseMessage.Headers = headers.ToDictionary(header => header.Key, header => new WireMockList<string>(head
 1164            return this;
 1165        }
 166
 167        /// <inheritdoc cref="IHeadersResponseBuilder.WithHeaders(IDictionary{string, WireMockList{string}})"/>
 168        public IResponseBuilder WithHeaders(IDictionary<string, WireMockList<string>> headers)
 1169        {
 1170            ResponseMessage.Headers = headers;
 1171            return this;
 1172        }
 173
 174        /// <inheritdoc cref="IBodyResponseBuilder.WithBody(Func{RequestMessage, string}, string, Encoding)"/>
 175        public IResponseBuilder WithBody(Func<RequestMessage, string> bodyFactory, string destination = BodyDestinationF
 1176        {
 1177            Check.NotNull(bodyFactory, nameof(bodyFactory));
 178
 2179            return WithCallbackInternal(false, req => new ResponseMessage
 2180            {
 2181                Body = bodyFactory(req),
 2182                BodyDestination = destination,
 2183                BodyEncoding = encoding ?? Encoding.UTF8
 2184            });
 1185        }
 186
 187        /// <inheritdoc cref="IBodyResponseBuilder.WithBody(byte[], string, Encoding)"/>
 188        public IResponseBuilder WithBody(byte[] body, string destination = BodyDestinationFormat.SameAsSource, Encoding 
 2189        {
 2190            Check.NotNull(body, nameof(body));
 191
 2192            ResponseMessage.BodyDestination = destination;
 193
 2194            switch (destination)
 195            {
 196                case BodyDestinationFormat.String:
 1197                    var enc = encoding ?? Encoding.UTF8;
 1198                    ResponseMessage.BodyAsBytes = null;
 1199                    ResponseMessage.Body = enc.GetString(body);
 1200                    ResponseMessage.BodyEncoding = enc;
 1201                    break;
 202
 203                default:
 1204                    ResponseMessage.BodyAsBytes = body;
 1205                    ResponseMessage.BodyEncoding = null;
 1206                    break;
 207            }
 208
 2209            return this;
 2210        }
 211
 212        /// <inheritdoc cref="IBodyResponseBuilder.WithBodyFromFile"/>
 213        public IResponseBuilder WithBodyFromFile(string filename, bool cache = true)
 3214        {
 3215            Check.NotNull(filename, nameof(filename));
 216
 3217            ResponseMessage.BodyEncoding = null;
 3218            ResponseMessage.BodyAsFileIsCached = cache;
 219
 3220            if (cache)
 3221            {
 3222                ResponseMessage.Body = null;
 3223                ResponseMessage.BodyAsBytes = File.ReadAllBytes(filename);
 3224                ResponseMessage.BodyAsFile = null;
 3225            }
 226            else
 0227            {
 0228                ResponseMessage.Body = null;
 0229                ResponseMessage.BodyAsBytes = null;
 0230                ResponseMessage.BodyAsFile = filename;
 0231            }
 232
 3233            return this;
 3234        }
 235
 236        /// <inheritdoc cref="IBodyResponseBuilder.WithBody(string, string, Encoding)"/>
 237        public IResponseBuilder WithBody(string body, string destination = BodyDestinationFormat.SameAsSource, Encoding 
 47238        {
 47239            Check.NotNull(body, nameof(body));
 240
 47241            encoding = encoding ?? Encoding.UTF8;
 242
 47243            ResponseMessage.BodyDestination = destination;
 47244            ResponseMessage.BodyEncoding = encoding;
 245
 47246            switch (destination)
 247            {
 248                case BodyDestinationFormat.Bytes:
 1249                    ResponseMessage.Body = null;
 1250                    ResponseMessage.BodyAsJson = null;
 1251                    ResponseMessage.BodyAsBytes = encoding.GetBytes(body);
 1252                    break;
 253
 254                case BodyDestinationFormat.Json:
 1255                    ResponseMessage.Body = null;
 1256                    ResponseMessage.BodyAsJson = JsonConvert.DeserializeObject(body);
 1257                    ResponseMessage.BodyAsBytes = null;
 1258                    break;
 259
 260                default:
 45261                    ResponseMessage.Body = body;
 45262                    ResponseMessage.BodyAsJson = null;
 45263                    ResponseMessage.BodyAsBytes = null;
 45264                    break;
 265            }
 266
 47267            return this;
 47268        }
 269
 270        /// <inheritdoc cref="IBodyResponseBuilder.WithBodyAsJson(object, Encoding, bool?)"/>
 271        public IResponseBuilder WithBodyAsJson(object body, Encoding encoding = null, bool? indented = null)
 16272        {
 16273            Check.NotNull(body, nameof(body));
 274
 16275            ResponseMessage.BodyDestination = null;
 16276            ResponseMessage.BodyAsJson = body;
 16277            ResponseMessage.BodyEncoding = encoding;
 16278            ResponseMessage.BodyAsJsonIndented = indented;
 279
 16280            return this;
 16281        }
 282
 283        /// <inheritdoc cref="IBodyResponseBuilder.WithBodyAsJson(object, bool)"/>
 284        public IResponseBuilder WithBodyAsJson(object body, bool indented)
 1285        {
 1286            return WithBodyAsJson(body, null, indented);
 1287        }
 288
 289        /// <inheritdoc cref="IBodyResponseBuilder.WithBodyFromBase64"/>
 290        public IResponseBuilder WithBodyFromBase64(string bodyAsbase64, Encoding encoding = null)
 1291        {
 1292            Check.NotNull(bodyAsbase64, nameof(bodyAsbase64));
 293
 1294            encoding = encoding ?? Encoding.UTF8;
 295
 1296            ResponseMessage.BodyDestination = null;
 1297            ResponseMessage.Body = encoding.GetString(Convert.FromBase64String(bodyAsbase64));
 1298            ResponseMessage.BodyEncoding = encoding;
 299
 1300            return this;
 1301        }
 302
 303        /// <inheritdoc cref="ITransformResponseBuilder.WithTransformer"/>
 304        public IResponseBuilder WithTransformer()
 32305        {
 32306            UseTransformer = true;
 32307            return this;
 32308        }
 309
 310        /// <inheritdoc cref="IDelayResponseBuilder.WithDelay(TimeSpan)"/>
 311        public IResponseBuilder WithDelay(TimeSpan delay)
 1312        {
 2313            Check.Condition(delay, d => d > TimeSpan.Zero, nameof(delay));
 314
 1315            Delay = delay;
 1316            return this;
 1317        }
 318
 319        /// <inheritdoc cref="IDelayResponseBuilder.WithDelay(int)"/>
 320        public IResponseBuilder WithDelay(int milliseconds)
 0321        {
 0322            return WithDelay(TimeSpan.FromMilliseconds(milliseconds));
 0323        }
 324
 325        /// <inheritdoc cref="IProxyResponseBuilder.WithProxy(string, string)"/>
 326        public IResponseBuilder WithProxy(string proxyUrl, string clientX509Certificate2ThumbprintOrSubjectName = null)
 0327        {
 0328            Check.NotNullOrEmpty(proxyUrl, nameof(proxyUrl));
 329
 0330            ProxyUrl = proxyUrl;
 0331            ClientX509Certificate2ThumbprintOrSubjectName = clientX509Certificate2ThumbprintOrSubjectName;
 0332            _httpClientForProxy = HttpClientHelper.CreateHttpClient(clientX509Certificate2ThumbprintOrSubjectName);
 0333            return this;
 0334        }
 335
 336        /// <inheritdoc cref="IProxyResponseBuilder.WithProxy(IProxyAndRecordSettings)"/>
 337        public IResponseBuilder WithProxy(IProxyAndRecordSettings settings)
 0338        {
 0339            Check.NotNull(settings, nameof(settings));
 340
 0341            return WithProxy(settings.Url, settings.ClientX509Certificate2ThumbprintOrSubjectName);
 0342        }
 343
 344        /// <inheritdoc cref="ICallbackResponseBuilder.WithCallback"/>
 345        public IResponseBuilder WithCallback(Func<RequestMessage, ResponseMessage> callbackHandler)
 1346        {
 1347            Check.NotNull(callbackHandler, nameof(callbackHandler));
 348
 1349            return WithCallbackInternal(true, callbackHandler);
 1350        }
 351
 352        /// <inheritdoc cref="ICallbackResponseBuilder.WithCallback"/>
 353        private IResponseBuilder WithCallbackInternal(bool withCallbackUsed, Func<RequestMessage, ResponseMessage> callb
 2354        {
 2355            Check.NotNull(callbackHandler, nameof(callbackHandler));
 356
 2357            WithCallbackUsed = withCallbackUsed;
 2358            Callback = callbackHandler;
 359
 2360            return this;
 2361        }
 362
 363        /// <summary>
 364        /// The provide response.
 365        /// </summary>
 366        /// <param name="requestMessage">The request.</param>
 367        /// <returns>The <see cref="ResponseMessage"/>.</returns>
 368        public async Task<ResponseMessage> ProvideResponseAsync(RequestMessage requestMessage)
 76369        {
 76370            Check.NotNull(requestMessage, nameof(requestMessage));
 371
 76372            if (Delay != null)
 1373            {
 1374                await Task.Delay(Delay.Value);
 1375            }
 376
 76377            if (Callback != null)
 2378            {
 2379                var callbackResponseMessage = Callback(requestMessage);
 380
 2381                if (!WithCallbackUsed)
 1382                {
 383                    // Copy StatusCode from ResponseMessage
 1384                    callbackResponseMessage.StatusCode = ResponseMessage.StatusCode;
 385
 386                    // Copy Headers from ResponseMessage (if defined)
 1387                    if (ResponseMessage.Headers != null)
 1388                    {
 1389                        callbackResponseMessage.Headers = ResponseMessage.Headers;
 1390                    }
 1391                }
 392
 2393                return callbackResponseMessage;
 394            }
 395
 74396            if (ProxyUrl != null && _httpClientForProxy != null)
 0397            {
 0398                var requestUri = new Uri(requestMessage.Url);
 0399                var proxyUri = new Uri(ProxyUrl);
 0400                var proxyUriWithRequestPathAndQuery = new Uri(proxyUri, requestUri.PathAndQuery);
 401
 0402                return await HttpClientHelper.SendAsync(_httpClientForProxy, requestMessage, proxyUriWithRequestPathAndQ
 403            }
 404
 74405            if (UseTransformer)
 32406            {
 32407                return ResponseMessageTransformer.Transform(requestMessage, ResponseMessage);
 408            }
 409
 410            // Just return normal defined ResponseMessage
 42411            return ResponseMessage;
 71412        }
 413    }
 414}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\ResponseBuilders\Response.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_ResponseMessage.htm b/report/coverlet/WireMock.Net_ResponseMessage.htm index 2e6722d2..c2b24859 100644 --- a/report/coverlet/WireMock.Net_ResponseMessage.htm +++ b/report/coverlet/WireMock.Net_ResponseMessage.htm @@ -20,7 +20,7 @@ Covered lines:18 Uncovered lines:3 Coverable lines:21 -Total lines:95 +Total lines:0 Line coverage:85.7% Branch coverage:50% @@ -35,107 +35,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\ResponseMessage.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System.Collections.Generic;
 2using System.Linq;
 3using System.Text;
 4using WireMock.Util;
 5using WireMock.Validation;
 6
 7namespace WireMock
 8{
 9    /// <summary>
 10    /// The ResponseMessage.
 11    /// </summary>
 12    public class ResponseMessage
 13    {
 14        /// <summary>
 15        /// Gets the headers.
 16        /// </summary>
 56217        public IDictionary<string, WireMockList<string>> Headers { get; set; } = new Dictionary<string, WireMockList<str
 18
 19        /// <summary>
 20        /// Gets or sets the status code.
 21        /// </summary>
 46422        public int StatusCode { get; set; } = 200;
 23
 24        /// <summary>
 25        /// Gets or sets the body.
 26        /// </summary>
 7227        public string BodyOriginal { get; set; }
 28
 29        /// <summary>
 30        /// Gets or sets the body destination (SameAsSource, String or Bytes).
 31        /// </summary>
 12332        public string BodyDestination { get; set; }
 33
 34        /// <summary>
 35        /// Gets or sets the body as a string.
 36        /// </summary>
 24937        public string Body { get; set; }
 38
 39        /// <summary>
 40        /// Gets or sets the body as a json object.
 41        /// </summary>
 28842        public object BodyAsJson { get; set; }
 43
 44        /// <summary>
 45        /// Gets or sets a value indicating whether child objects to be indented according to the Newtonsoft.Json.JsonTe
 46        /// </summary>
 3547        public bool? BodyAsJsonIndented { get; set; }
 48
 49        /// <summary>
 50        /// Gets or sets the body as bytes.
 51        /// </summary>
 16652        public byte[] BodyAsBytes { get; set; }
 53
 54        /// <summary>
 55        /// Gets or sets the body as a file.
 56        /// </summary>
 10857        public string BodyAsFile { get; set; }
 58
 59        /// <summary>
 60        /// Is the body as file cached?
 61        /// </summary>
 5962        public bool? BodyAsFileIsCached { get; set; }
 63
 64        /// <summary>
 65        /// Gets or sets the body encoding.
 66        /// </summary>
 48167        public Encoding BodyEncoding { get; set; } = new UTF8Encoding(false);
 68
 69        /// <summary>
 70        /// Adds the header.
 71        /// </summary>
 72        /// <param name="name">The name.</param>
 73        /// <param name="value">The value.</param>
 74        public void AddHeader(string name, string value)
 075        {
 076            Headers.Add(name, new WireMockList<string>(value));
 077        }
 78
 79        /// <summary>
 80        /// Adds the header.
 81        /// </summary>
 82        /// <param name="name">The name.</param>
 83        /// <param name="values">The values.</param>
 84        public void AddHeader(string name, params string[] values)
 10285        {
 10286            Check.NotNullOrEmpty(values, nameof(values));
 87
 10288            var newHeaderValues = Headers.TryGetValue(name, out WireMockList<string> existingValues)
 10289                ? values.Union(existingValues).ToArray()
 10290                : values;
 91
 10292            Headers[name] = new WireMockList<string>(newHeaderValues);
 10293        }
 94    }
 95}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\ResponseMessage.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_ResponseMessageBuilder.htm b/report/coverlet/WireMock.Net_ResponseMessageBuilder.htm index 3ccc5730..a53f69ae 100644 --- a/report/coverlet/WireMock.Net_ResponseMessageBuilder.htm +++ b/report/coverlet/WireMock.Net_ResponseMessageBuilder.htm @@ -20,7 +20,7 @@ Covered lines:11 Uncovered lines:0 Coverable lines:11 -Total lines:26 +Total lines:0 Line coverage:100% Branch coverage:100% @@ -35,38 +35,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\ResponseMessageBuilder.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using WireMock.Admin.Mappings;
 4using WireMock.Http;
 5using WireMock.Util;
 6
 7namespace WireMock
 8{
 9    internal static class ResponseMessageBuilder
 10    {
 111        private static string ContentTypeJson = "application/json";
 112        private static readonly IDictionary<string, WireMockList<string>> ContentTypeJsonHeaders = new Dictionary<string
 13
 14        internal static ResponseMessage Create(string message, int statusCode = 200, Guid? guid = null)
 1815        {
 1816            var response = new ResponseMessage
 1817            {
 1818                StatusCode = statusCode,
 1819                Headers = ContentTypeJsonHeaders,
 1820                BodyAsJson = message != null ? new StatusModel { Status = message, Guid = guid } : null
 1821            };
 22
 1823            return response;
 1824        }
 25    }
 26}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\ResponseMessageBuilder.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_ResponseMessageTransformer.htm b/report/coverlet/WireMock.Net_ResponseMessageTransformer.htm index b284cc4c..4484f2c0 100644 --- a/report/coverlet/WireMock.Net_ResponseMessageTransformer.htm +++ b/report/coverlet/WireMock.Net_ResponseMessageTransformer.htm @@ -20,7 +20,7 @@ Covered lines:78 Uncovered lines:4 Coverable lines:82 -Total lines:135 +Total lines:0 Line coverage:95.1% Branch coverage:92.8% @@ -38,147 +38,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Transformers\ResponseMessageTransformer.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using System.Linq;
 4using HandlebarsDotNet;
 5using Newtonsoft.Json;
 6using Newtonsoft.Json.Linq;
 7using WireMock.Util;
 8
 9namespace WireMock.Transformers
 10{
 11    internal static class ResponseMessageTransformer
 12    {
 13        static ResponseMessageTransformer()
 114        {
 115            HandlebarsHelpers.Register();
 116        }
 17
 18        public static ResponseMessage Transform(RequestMessage requestMessage, ResponseMessage original)
 3219        {
 3220            bool bodyIsJson = original.BodyAsJson != null;
 3221            var responseMessage = new ResponseMessage { StatusCode = original.StatusCode };
 22
 3223            if (!bodyIsJson)
 1924            {
 1925                responseMessage.BodyOriginal = original.Body;
 1926            }
 27
 3228            var template = new { request = requestMessage };
 29
 3230            if (!bodyIsJson)
 1931            {
 1932                TransformBodyAsString(template, original, responseMessage);
 1733            }
 34            else
 1335            {
 1336                TransformBodyAsJson(template, original, responseMessage);
 1037            }
 38
 39            // Headers
 2740            var newHeaders = new Dictionary<string, WireMockList<string>>();
 10541            foreach (var header in original.Headers)
 1242            {
 1243                var templateHeaderKey = Handlebars.Compile(header.Key);
 1244                var templateHeaderValues = header.Value
 1245                    .Select(Handlebars.Compile)
 2546                    .Select(func => func(template))
 1247                    .ToArray();
 48
 1249                newHeaders.Add(templateHeaderKey(template), new WireMockList<string>(templateHeaderValues));
 1250            }
 51
 2752            responseMessage.Headers = newHeaders;
 53
 2754            return responseMessage;
 2755        }
 56
 57        private static void TransformBodyAsJson(object template, ResponseMessage original, ResponseMessage responseMessa
 1358        {
 59            JToken jToken;
 1360            switch (original.BodyAsJson)
 61            {
 62                case JObject bodyAsJObject:
 063                    jToken = bodyAsJObject;
 064                    break;
 65
 66                case Array bodyAsArray:
 167                    jToken = JArray.FromObject(bodyAsArray);
 168                    break;
 69
 70                default:
 1271                    jToken = JObject.FromObject(original.BodyAsJson);
 1272                    break;
 73            }
 74
 1375            WalkNode(jToken, template);
 76
 1077            responseMessage.BodyAsJson = jToken;
 1078        }
 79
 80        private static void WalkNode(JToken node, object template)
 3081        {
 3082            if (node.Type == JTokenType.Object)
 1283            {
 84                // In case of Object, loop all children. Do a ToArray() to avoid `Collection was modified` exceptions.
 5785                foreach (JProperty child in node.Children<JProperty>().ToArray())
 1286                {
 1287                    WalkNode(child.Value, template);
 988                }
 989            }
 1890            else if (node.Type == JTokenType.Array)
 191            {
 92                // In case of Array, loop all items. Do a ToArray() to avoid `Collection was modified` exceptions.
 1393                foreach (JToken child in node.Children().ToArray())
 594                {
 595                    WalkNode(child, template);
 596                }
 197            }
 1798            else if (node.Type == JTokenType.String)
 1799            {
 100                // In case of string, try to transform the value.
 17101                string stringValue = node.Value<string>();
 17102                if (string.IsNullOrEmpty(stringValue))
 0103                {
 0104                    return;
 105                }
 106
 17107                var templateForStringValue = Handlebars.Compile(stringValue);
 17108                string transformedString = templateForStringValue(template);
 14109                if (!string.Equals(stringValue, transformedString))
 12110                {
 111                    JToken value;
 112                    try
 12113                    {
 114                        // Try to convert this string into a real JsonObject
 12115                        value = JToken.Parse(transformedString);
 2116                    }
 10117                    catch (JsonException)
 10118                    {
 119                        // Ignore JsonException and just convert to JToken
 10120                        value = transformedString;
 10121                    }
 122
 12123                    node.Replace(value);
 12124                }
 14125            }
 24126        }
 127
 128        private static void TransformBodyAsString(object template, ResponseMessage original, ResponseMessage responseMes
 19129        {
 19130            var templateBody = Handlebars.Compile(original.Body);
 131
 19132            responseMessage.Body = templateBody(template);
 17133        }
 134    }
 135}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Transformers\ResponseMessageTransformer.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_ResponseModel.htm b/report/coverlet/WireMock.Net_ResponseModel.htm index c672841e..2f4b1020 100644 --- a/report/coverlet/WireMock.Net_ResponseModel.htm +++ b/report/coverlet/WireMock.Net_ResponseModel.htm @@ -20,108 +20,14 @@ Covered lines:16 Uncovered lines:0 Coverable lines:16 -Total lines:90 +Total lines:0 Line coverage:100%

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Admin\Mappings\ResponseModel.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System.Collections.Generic;
 2
 3namespace WireMock.Admin.Mappings
 4{
 5    /// <summary>
 6    /// ResponseModel
 7    /// </summary>
 8    public class ResponseModel
 9    {
 10        /// <summary>
 11        /// Gets or sets the HTTP status.
 12        /// </summary>
 3613        public int? StatusCode { get; set; }
 14
 15        /// <summary>
 16        /// Gets or sets the body destination (SameAsSource, String or Bytes).
 17        /// </summary>
 1218        public string BodyDestination { get; set; }
 19
 20        /// <summary>
 21        /// Gets or sets the body.
 22        /// </summary>
 3023        public string Body { get; set; }
 24
 25        /// <summary>
 26        /// Gets or sets the body.
 27        /// </summary>
 628        public string BodyFromBase64 { get; set; }
 29
 30        /// <summary>
 31        /// Gets or sets the body (as JSON object).
 32        /// </summary>
 1233        public object BodyAsJson { get; set; }
 34
 35        /// <summary>
 36        /// Gets or sets a value indicating whether child objects to be indented according to the Newtonsoft.Json.JsonTe
 37        /// </summary>
 638        public bool? BodyAsJsonIndented { get; set; }
 39
 40        /// <summary>
 41        /// Gets or sets the body (as bytearray).
 42        /// </summary>
 1643        public byte[] BodyAsBytes { get; set; }
 44
 45        /// <summary>
 46        /// Gets or sets the body as a file.
 47        /// </summary>
 1448        public string BodyAsFile { get; set; }
 49
 50        /// <summary>
 51        /// Is the body as file cached?
 52        /// </summary>
 553        public bool? BodyAsFileIsCached { get; set; }
 54
 55        /// <summary>
 56        /// Gets or sets the body encoding.
 57        /// </summary>
 2358        public EncodingModel BodyEncoding { get; set; }
 59
 60        /// <summary>
 61        /// Gets or sets a value indicating whether [use transformer].
 62        /// </summary>
 2263        public bool UseTransformer { get; set; }
 64
 65        /// <summary>
 66        /// Gets or sets the headers.
 67        /// </summary>
 4368        public IDictionary<string, object> Headers { get; set; }
 69
 70        /// <summary>
 71        /// Gets or sets the Headers (Raw).
 72        /// </summary>
 573        public string HeadersRaw { get; set; }
 74
 75        /// <summary>
 76        /// Gets or sets the delay in milliseconds.
 77        /// </summary>
 1678        public int? Delay { get; set; }
 79
 80        /// <summary>
 81        /// Gets or sets the Proxy URL.
 82        /// </summary>
 1483        public string ProxyUrl { get; set; }
 84
 85        /// <summary>
 86        /// The client X509Certificate2 Thumbprint or SubjectName to use.
 87        /// </summary>
 388        public string X509Certificate2ThumbprintOrSubjectName { get; set; }
 89    }
 90}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Admin\Mappings\ResponseModel.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_ScenarioState.htm b/report/coverlet/WireMock.Net_ScenarioState.htm index 552b5dfa..096d4921 100644 --- a/report/coverlet/WireMock.Net_ScenarioState.htm +++ b/report/coverlet/WireMock.Net_ScenarioState.htm @@ -20,46 +20,14 @@ Covered lines:4 Uncovered lines:0 Coverable lines:4 -Total lines:28 +Total lines:0 Line coverage:100%

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\ScenarioState.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1namespace WireMock
 2{
 3    /// <summary>
 4    /// The ScenarioState
 5    /// </summary>
 6    public class ScenarioState
 7    {
 8        /// <summary>
 9        /// Gets or sets the Name (from the Scenario).
 10        /// </summary>
 711        public string Name { get; set; }
 12
 13        /// <summary>
 14        /// Gets or sets the NextState.
 15        /// </summary>
 4116        public string NextState { get; set; }
 17
 18        /// <summary>
 19        /// Gets or sets a value indicating whether this <see cref="ScenarioState"/> is started.
 20        /// </summary>
 1221        public bool Started { get; set; }
 22
 23        /// <summary>
 24        /// Gets or sets a value indicating whether this <see cref="ScenarioState"/> is finished.
 25        /// </summary>
 1226        public bool Finished { get; set; }
 27    }
 28}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\ScenarioState.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_ScenarioStateModel.htm b/report/coverlet/WireMock.Net_ScenarioStateModel.htm index 47f8bb78..c24827b2 100644 --- a/report/coverlet/WireMock.Net_ScenarioStateModel.htm +++ b/report/coverlet/WireMock.Net_ScenarioStateModel.htm @@ -20,46 +20,14 @@ Covered lines:0 Uncovered lines:4 Coverable lines:4 -Total lines:28 +Total lines:0 Line coverage:0%

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Admin\Scenarios\ScenarioStateModel.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1namespace WireMock.Admin.Scenarios
 2{
 3    /// <summary>
 4    /// ScenarioStateModel
 5    /// </summary>
 6    public class ScenarioStateModel
 7    {
 8        /// <summary>
 9        /// Gets or sets the name.
 10        /// </summary>
 011        public string Name { get; set; }
 12
 13        /// <summary>
 14        /// Gets or sets the NextState.
 15        /// </summary>
 016        public string NextState { get; set; }
 17
 18        /// <summary>
 19        /// Gets or sets a value indicating whether this <see cref="ScenarioStateModel"/> is started.
 20        /// </summary>
 021        public bool Started { get; set; }
 22
 23        /// <summary>
 24        /// Gets or sets a value indicating whether this <see cref="ScenarioStateModel"/> is finished.
 25        /// </summary>
 026        public bool Finished { get; set; }
 27    }
 28}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Admin\Scenarios\ScenarioStateModel.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_SettingsModel.htm b/report/coverlet/WireMock.Net_SettingsModel.htm index 4c389a20..1469c681 100644 --- a/report/coverlet/WireMock.Net_SettingsModel.htm +++ b/report/coverlet/WireMock.Net_SettingsModel.htm @@ -20,46 +20,14 @@ Covered lines:4 Uncovered lines:0 Coverable lines:4 -Total lines:28 +Total lines:0 Line coverage:100%

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Admin\Settings\SettingsModel.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1namespace WireMock.Admin.Settings
 2{
 3    /// <summary>
 4    /// Settings
 5    /// </summary>
 6    public class SettingsModel
 7    {
 8        /// <summary>
 9        /// Gets or sets the global delay in milliseconds.
 10        /// </summary>
 811        public int? GlobalProcessingDelay { get; set; }
 12
 13        /// <summary>
 14        /// Gets or sets if partial mapping is allowed.
 15        /// </summary>
 916        public bool? AllowPartialMapping { get; set; }
 17
 18        /// <summary>
 19        /// Gets or sets the RequestLog expiration in hours
 20        /// </summary>
 821        public int? RequestLogExpirationDuration { get; set; }
 22
 23        /// <summary>
 24        /// Gets or sets the MaxRequestLog count.
 25        /// </summary>
 826        public int? MaxRequestLogCount { get; set; }
 27    }
 28}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Admin\Settings\SettingsModel.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_SimMetricsMatcher.htm b/report/coverlet/WireMock.Net_SimMetricsMatcher.htm index 4008d6e0..384709cf 100644 --- a/report/coverlet/WireMock.Net_SimMetricsMatcher.htm +++ b/report/coverlet/WireMock.Net_SimMetricsMatcher.htm @@ -20,7 +20,7 @@ Covered lines:29 Uncovered lines:17 Coverable lines:46 -Total lines:125 +Total lines:0 Line coverage:63% Branch coverage:10.5% @@ -40,137 +40,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\SimMetricsMatcher.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System.Linq;
 2using JetBrains.Annotations;
 3using SimMetrics.Net;
 4using SimMetrics.Net.API;
 5using SimMetrics.Net.Metric;
 6using WireMock.Validation;
 7
 8namespace WireMock.Matchers
 9{
 10    /// <summary>
 11    /// SimMetricsMatcher
 12    /// </summary>
 13    /// <seealso cref="IStringMatcher" />
 14    public class SimMetricsMatcher : IStringMatcher
 15    {
 16        private readonly string[] _patterns;
 17        private readonly SimMetricType _simMetricType;
 18
 19        /// <inheritdoc cref="IMatcher.MatchBehaviour"/>
 420        public MatchBehaviour MatchBehaviour { get; }
 21
 22        /// <summary>
 23        /// Initializes a new instance of the <see cref="SimMetricsMatcher"/> class.
 24        /// </summary>
 25        /// <param name="pattern">The pattern.</param>
 26        /// <param name="simMetricType">The SimMetric Type</param>
 527        public SimMetricsMatcher([NotNull] string pattern, SimMetricType simMetricType = SimMetricType.Levenstein) : thi
 528        {
 529        }
 30
 31        /// <summary>
 32        /// Initializes a new instance of the <see cref="SimMetricsMatcher"/> class.
 33        /// </summary>
 34        /// <param name="matchBehaviour">The match behaviour.</param>
 35        /// <param name="pattern">The pattern.</param>
 36        /// <param name="simMetricType">The SimMetric Type</param>
 337        public SimMetricsMatcher(MatchBehaviour matchBehaviour, [NotNull] string pattern, SimMetricType simMetricType = 
 338        {
 339        }
 40
 41        /// <summary>
 42        /// Initializes a new instance of the <see cref="SimMetricsMatcher"/> class.
 43        /// </summary>
 44        /// <param name="patterns">The patterns.</param>
 45        /// <param name="simMetricType">The SimMetric Type</param>
 546        public SimMetricsMatcher([NotNull] string[] patterns, SimMetricType simMetricType = SimMetricType.Levenstein) : 
 547        {
 548        }
 49
 50        /// <summary>
 51        /// Initializes a new instance of the <see cref="SimMetricsMatcher"/> class.
 52        /// </summary>
 53        /// <param name="matchBehaviour">The match behaviour.</param>
 54        /// <param name="patterns">The patterns.</param>
 55        /// <param name="simMetricType">The SimMetric Type</param>
 856        public SimMetricsMatcher(MatchBehaviour matchBehaviour, [NotNull] string[] patterns, SimMetricType simMetricType
 857        {
 858            Check.NotNullOrEmpty(patterns, nameof(patterns));
 59
 860            MatchBehaviour = matchBehaviour;
 861            _patterns = patterns;
 862            _simMetricType = simMetricType;
 863        }
 64
 65        /// <inheritdoc cref="IStringMatcher.IsMatch"/>
 66        public double IsMatch(string input)
 467        {
 468            IStringMetric m = GetStringMetricType();
 69
 1270            return MatchBehaviourHelper.Convert(MatchBehaviour, MatchScores.ToScore(_patterns.Select(p => m.GetSimilarit
 471        }
 72
 73        private IStringMetric GetStringMetricType()
 474        {
 475            switch (_simMetricType)
 76            {
 77                case SimMetricType.BlockDistance:
 078                    return new BlockDistance();
 79                case SimMetricType.ChapmanLengthDeviation:
 080                    return new ChapmanLengthDeviation();
 81                case SimMetricType.CosineSimilarity:
 082                    return new CosineSimilarity();
 83                case SimMetricType.DiceSimilarity:
 084                    return new DiceSimilarity();
 85                case SimMetricType.EuclideanDistance:
 086                    return new EuclideanDistance();
 87                case SimMetricType.JaccardSimilarity:
 088                    return new JaccardSimilarity();
 89                case SimMetricType.Jaro:
 090                    return new Jaro();
 91                case SimMetricType.JaroWinkler:
 092                    return new JaroWinkler();
 93                case SimMetricType.MatchingCoefficient:
 094                    return new MatchingCoefficient();
 95                case SimMetricType.MongeElkan:
 096                    return new MongeElkan();
 97                case SimMetricType.NeedlemanWunch:
 098                    return new NeedlemanWunch();
 99                case SimMetricType.OverlapCoefficient:
 0100                    return new OverlapCoefficient();
 101                case SimMetricType.QGramsDistance:
 0102                    return new QGramsDistance();
 103                case SimMetricType.SmithWaterman:
 0104                    return new SmithWaterman();
 105                case SimMetricType.SmithWatermanGotoh:
 0106                    return new SmithWatermanGotoh();
 107                case SimMetricType.SmithWatermanGotohWindowedAffine:
 0108                    return new SmithWatermanGotohWindowedAffine();
 109                case SimMetricType.ChapmanMeanLength:
 0110                    return new ChapmanMeanLength();
 111                default:
 4112                    return new Levenstein();
 113            }
 4114        }
 115
 116        /// <inheritdoc cref="IStringMatcher.GetPatterns"/>
 117        public string[] GetPatterns()
 3118        {
 3119            return _patterns;
 3120        }
 121
 122        /// <inheritdoc cref="IMatcher.Name"/>
 1123        public string Name => $"SimMetricsMatcher.{_simMetricType}";
 124    }
 125}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\SimMetricsMatcher.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_StatusModel.htm b/report/coverlet/WireMock.Net_StatusModel.htm index 460ccf32..6ece03f9 100644 --- a/report/coverlet/WireMock.Net_StatusModel.htm +++ b/report/coverlet/WireMock.Net_StatusModel.htm @@ -20,38 +20,14 @@ Covered lines:2 Uncovered lines:0 Coverable lines:2 -Total lines:20 +Total lines:0 Line coverage:100%

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Admin\Mappings\StatusModel.cs

- - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2
 3namespace WireMock.Admin.Mappings
 4{
 5    /// <summary>
 6    /// Status
 7    /// </summary>
 8    public class StatusModel
 9    {
 10        /// <summary>
 11        /// The optional guid.
 12        /// </summary>
 3613        public Guid? Guid { get; set; }
 14
 15        /// <summary>
 16        /// The status (can also contain the error message).
 17        /// </summary>
 4118        public string Status { get; set; }
 19    }
 20}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Admin\Mappings\StatusModel.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_UrlDetails.htm b/report/coverlet/WireMock.Net_UrlDetails.htm index ccf604b7..079458c8 100644 --- a/report/coverlet/WireMock.Net_UrlDetails.htm +++ b/report/coverlet/WireMock.Net_UrlDetails.htm @@ -20,7 +20,7 @@ Covered lines:15 Uncovered lines:0 Coverable lines:15 -Total lines:51 +Total lines:0 Line coverage:100% @@ -35,63 +35,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Models\UrlDetails.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using WireMock.Validation;
 3
 4namespace WireMock.Models
 5{
 6    /// <summary>
 7    /// UrlDetails
 8    /// </summary>
 9    public class UrlDetails
 10    {
 11        /// <summary>
 12        /// Gets the url (relative).
 13        /// </summary>
 120314        public Uri Url { get; }
 15
 16        /// <summary>
 17        /// Gets the AbsoluteUrl.
 18        /// </summary>
 40319        public Uri AbsoluteUrl { get; }
 20
 21        /// <summary>
 22        /// Initializes a new instance of the <see cref="UrlDetails"/> class.
 23        /// </summary>
 24        /// <param name="url">The URL.</param>
 15225        public UrlDetails(string url) : this(new Uri(url))
 15226        {
 15227        }
 28
 29        /// <summary>
 30        /// Initializes a new instance of the <see cref="UrlDetails"/> class.
 31        /// </summary>
 32        /// <param name="url">The URL.</param>
 15233        public UrlDetails(Uri url) : this(url, url)
 15234        {
 15235        }
 36
 37        /// <summary>
 38        /// Initializes a new instance of the <see cref="UrlDetails"/> class.
 39        /// </summary>
 40        /// <param name="absoluteUrl">The absolute URL.</param>
 41        /// <param name="url">The URL (relative).</param>
 20342        public UrlDetails(Uri absoluteUrl, Uri url)
 20343        {
 20344            Check.NotNull(absoluteUrl, nameof(absoluteUrl));
 20345            Check.NotNull(url, nameof(url));
 46
 20347            AbsoluteUrl = absoluteUrl;
 20348            Url = url;
 20349        }
 50    }
 51}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Models\UrlDetails.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_UrlModel.htm b/report/coverlet/WireMock.Net_UrlModel.htm index 5558a368..16a7c3a2 100644 --- a/report/coverlet/WireMock.Net_UrlModel.htm +++ b/report/coverlet/WireMock.Net_UrlModel.htm @@ -20,31 +20,14 @@ Covered lines:0 Uncovered lines:1 Coverable lines:1 -Total lines:13 +Total lines:0 Line coverage:0%

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Admin\Mappings\UrlModel.cs

- - - - - - - - - - - - - - - - - -
#LineLine coverage
 1namespace WireMock.Admin.Mappings
 2{
 3    /// <summary>
 4    /// UrlModel
 5    /// </summary>
 6    public class UrlModel
 7    {
 8        /// <summary>
 9        /// Gets or sets the matchers.
 10        /// </summary>
 011        public MatcherModel[] Matchers { get; set; }
 12    }
 13}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Admin\Mappings\UrlModel.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_UrlUtils.htm b/report/coverlet/WireMock.Net_UrlUtils.htm index 9b90e362..be7585a4 100644 --- a/report/coverlet/WireMock.Net_UrlUtils.htm +++ b/report/coverlet/WireMock.Net_UrlUtils.htm @@ -20,7 +20,7 @@ Covered lines:15 Uncovered lines:0 Coverable lines:15 -Total lines:38 +Total lines:0 Line coverage:100% Branch coverage:100% @@ -35,50 +35,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Util\UrlUtils.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using JetBrains.Annotations;
 3using WireMock.Models;
 4#if !USE_ASPNETCORE
 5using Microsoft.Owin;
 6#else
 7using Microsoft.AspNetCore.Http;
 8#endif
 9
 10namespace WireMock.Util
 11{
 12    internal static class UrlUtils
 13    {
 14        public static UrlDetails Parse([NotNull] Uri uri, PathString pathBase)
 5115        {
 5116            if (!pathBase.HasValue)
 4717            {
 4718                return new UrlDetails(uri, uri);
 19            }
 20
 421            var builder = new UriBuilder(uri);
 422            builder.Path = RemoveFirst(builder.Path, pathBase.Value);
 23
 424            return new UrlDetails(uri, builder.Uri);
 5125        }
 26
 27        private static string RemoveFirst(string text, string search)
 428        {
 429            int pos = text.IndexOf(search);
 430            if (pos < 0)
 131            {
 132                return text;
 33            }
 34
 335            return text.Substring(0, pos) + text.Substring(pos + search.Length);
 436        }
 37    }
 38}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Util\UrlUtils.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_WildcardMatcher.htm b/report/coverlet/WireMock.Net_WildcardMatcher.htm index c73521a6..23061eee 100644 --- a/report/coverlet/WireMock.Net_WildcardMatcher.htm +++ b/report/coverlet/WireMock.Net_WildcardMatcher.htm @@ -20,7 +20,7 @@ Covered lines:17 Uncovered lines:0 Coverable lines:17 -Total lines:63 +Total lines:0 Line coverage:100% Branch coverage:100% @@ -38,75 +38,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\WildcardMatcher.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System.Linq;
 2using System.Text.RegularExpressions;
 3using JetBrains.Annotations;
 4
 5namespace WireMock.Matchers
 6{
 7    /// <summary>
 8    /// WildcardMatcher
 9    /// </summary>
 10    /// <seealso cref="RegexMatcher" />
 11    public class WildcardMatcher : RegexMatcher
 12    {
 13        private readonly string[] _patterns;
 14
 15        /// <summary>
 16        /// Initializes a new instance of the <see cref="WildcardMatcher"/> class.
 17        /// </summary>
 18        /// <param name="pattern">The pattern.</param>
 19        /// <param name="ignoreCase">IgnoreCase</param>
 3020        public WildcardMatcher([NotNull] string pattern, bool ignoreCase = false) : this(new[] { pattern }, ignoreCase)
 3021        {
 3022        }
 23
 24        /// <summary>
 25        /// Initializes a new instance of the <see cref="WildcardMatcher"/> class.
 26        /// </summary>
 27        /// <param name="matchBehaviour">The match behaviour.</param>
 28        /// <param name="pattern">The pattern.</param>
 29        /// <param name="ignoreCase">IgnoreCase</param>
 26430        public WildcardMatcher(MatchBehaviour matchBehaviour, [NotNull] string pattern, bool ignoreCase = false) : this(
 26531        {
 26532        }
 33
 34        /// <summary>
 35        /// Initializes a new instance of the <see cref="WildcardMatcher"/> class.
 36        /// </summary>
 37        /// <param name="patterns">The patterns.</param>
 38        /// <param name="ignoreCase">IgnoreCase</param>
 3039        public WildcardMatcher([NotNull] string[] patterns, bool ignoreCase = false) : this(MatchBehaviour.AcceptOnMatch
 3040        {
 3041        }
 42
 43        /// <summary>
 44        /// Initializes a new instance of the <see cref="WildcardMatcher"/> class.
 45        /// </summary>
 46        /// <param name="matchBehaviour">The match behaviour.</param>
 47        /// <param name="patterns">The patterns.</param>
 48        /// <param name="ignoreCase">IgnoreCase</param>
 60249        public WildcardMatcher(MatchBehaviour matchBehaviour, [NotNull] string[] patterns, bool ignoreCase = false) : ba
 30050        {
 30051            _patterns = patterns;
 30052        }
 53
 54        /// <inheritdoc cref="IStringMatcher.GetPatterns"/>
 55        public override string[] GetPatterns()
 356        {
 357            return _patterns;
 358        }
 59
 60        /// <inheritdoc cref="IMatcher.Name"/>
 261        public override string Name => "WildcardMatcher";
 62    }
 63}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\WildcardMatcher.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_WireMockConsoleLogger.htm b/report/coverlet/WireMock.Net_WireMockConsoleLogger.htm index 196ccaf8..47dc395f 100644 --- a/report/coverlet/WireMock.Net_WireMockConsoleLogger.htm +++ b/report/coverlet/WireMock.Net_WireMockConsoleLogger.htm @@ -20,7 +20,7 @@ Covered lines:0 Uncovered lines:24 Coverable lines:24 -Total lines:59 +Total lines:0 Line coverage:0% Branch coverage:0% @@ -40,71 +40,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Logging\WireMockConsoleLogger.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using Newtonsoft.Json;
 3using WireMock.Admin.Requests;
 4
 5namespace WireMock.Logging
 6{
 7    /// <summary>
 8    /// WireMockConsoleLogger which logs to Console
 9    /// </summary>
 10    /// <seealso cref="IWireMockLogger" />
 11    public class WireMockConsoleLogger : IWireMockLogger
 12    {
 13        /// <summary>
 14        /// Initializes a new instance of the <see cref="WireMockConsoleLogger"/> class.
 15        /// </summary>
 016        public WireMockConsoleLogger()
 017        {
 018            Console.OutputEncoding = System.Text.Encoding.UTF8;
 019        }
 20
 21        /// <see cref="IWireMockLogger.Debug"/>
 22        public void Debug(string formatString, params object[] args)
 023        {
 024            Console.WriteLine(Format("Debug", formatString, args));
 025        }
 26
 27        /// <see cref="IWireMockLogger.Info"/>
 28        public void Info(string formatString, params object[] args)
 029        {
 030            Console.WriteLine(Format("Info", formatString, args));
 031        }
 32
 33        /// <see cref="IWireMockLogger.Warn"/>
 34        public void Warn(string formatString, params object[] args)
 035        {
 036            Console.WriteLine(Format("Warn", formatString, args));
 037        }
 38
 39        /// <see cref="IWireMockLogger.Error"/>
 40        public void Error(string formatString, params object[] args)
 041        {
 042            Console.WriteLine(Format("Error", formatString, args));
 043        }
 44
 45        /// <see cref="IWireMockLogger.DebugRequestResponse"/>
 46        public void DebugRequestResponse(LogEntryModel logEntryModel, bool isAdminRequest)
 047        {
 048            string message = JsonConvert.SerializeObject(logEntryModel, Formatting.Indented);
 049            Console.WriteLine(Format("DebugRequestResponse", "Admin[{0}] {1}", isAdminRequest, message));
 050        }
 51
 52        private static string Format(string level, string formatString, params object[] args)
 053        {
 054            var message = args.Length > 0 ? string.Format(formatString, args) : formatString;
 55
 056            return $"{DateTime.UtcNow} [{level}] : {message}";
 057        }
 58    }
 59}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Logging\WireMockConsoleLogger.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_WireMockList_1.htm b/report/coverlet/WireMock.Net_WireMockList_1.htm index 26af0e89..66b82f98 100644 --- a/report/coverlet/WireMock.Net_WireMockList_1.htm +++ b/report/coverlet/WireMock.Net_WireMockList_1.htm @@ -20,7 +20,7 @@ Covered lines:9 Uncovered lines:3 Coverable lines:12 -Total lines:44 +Total lines:0 Line coverage:75% Branch coverage:50% @@ -37,56 +37,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Util\WireMockList.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System.Collections.Generic;
 2using System.Linq;
 3
 4namespace WireMock.Util
 5{
 6    /// <summary>
 7    /// A special List which overrides the ToString() to return first value.
 8    /// </summary>
 9    /// <typeparam name="T">The generic type</typeparam>
 10    /// <seealso cref="List{T}" />
 11    public class WireMockList<T> : List<T>
 12    {
 13        /// <summary>
 14        /// Initializes a new instance of the <see cref="WireMockList{T}"/> class.
 15        /// </summary>
 3016        public WireMockList()
 3017        {
 3018        }
 19
 20        /// <summary>
 21        /// Initializes a new instance of the <see cref="WireMockList{T}"/> class.
 22        /// </summary>
 23        /// <param name="collection">The collection whose elements are copied to the new list.</param>
 20624        public WireMockList(params T[] collection) : base(collection)
 20625        {
 20626        }
 27
 28        /// <summary>
 29        /// Initializes a new instance of the <see cref="WireMockList{T}"/> class.
 30        /// </summary>
 31        /// <param name="collection">The collection whose elements are copied to the new list.</param>
 032        public WireMockList(IEnumerable<T> collection) : base(collection)
 033        {
 034        }
 35
 36        /// <summary>
 37        /// Returns a <see cref="string" /> that represents this instance.
 38        /// </summary>
 39        public override string ToString()
 1140        {
 1141            return this.Any() ? this.First().ToString() : base.ToString();
 1142        }
 43    }
 44}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Util\WireMockList.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_WireMockMiddleware.htm b/report/coverlet/WireMock.Net_WireMockMiddleware.htm index be13fe85..e681604b 100644 --- a/report/coverlet/WireMock.Net_WireMockMiddleware.htm +++ b/report/coverlet/WireMock.Net_WireMockMiddleware.htm @@ -20,7 +20,7 @@ Covered lines:102 Uncovered lines:6 Coverable lines:108 -Total lines:188 +Total lines:0 Line coverage:94.4% Branch coverage:86.3% @@ -38,200 +38,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Owin\WireMockMiddleware.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using System.Threading.Tasks;
 3using WireMock.Logging;
 4using WireMock.Matchers.Request;
 5using System.Linq;
 6using WireMock.Matchers;
 7using WireMock.Util;
 8using Newtonsoft.Json;
 9using WireMock.Http;
 10using WireMock.Owin.Mappers;
 11using WireMock.Serialization;
 12using WireMock.Validation;
 13#if !USE_ASPNETCORE
 14using Microsoft.Owin;
 15using IContext = Microsoft.Owin.IOwinContext;
 16using OwinMiddleware = Microsoft.Owin.OwinMiddleware;
 17using Next = Microsoft.Owin.OwinMiddleware;
 18#else
 19using OwinMiddleware = System.Object;
 20using IContext = Microsoft.AspNetCore.Http.HttpContext;
 21using Next = Microsoft.AspNetCore.Http.RequestDelegate;
 22#endif
 23
 24namespace WireMock.Owin
 25{
 26    internal class WireMockMiddleware : OwinMiddleware
 27    {
 128        private static readonly Task CompletedTask = Task.FromResult(false);
 29        private readonly IWireMockMiddlewareOptions _options;
 30        private readonly IOwinRequestMapper _requestMapper;
 31        private readonly IOwinResponseMapper _responseMapper;
 32        private readonly IMappingMatcher _mappingMatcher;
 33
 34#if !USE_ASPNETCORE
 35        public WireMockMiddleware(Next next, IWireMockMiddlewareOptions options, IOwinRequestMapper requestMapper, IOwin
 36        {
 37            Check.NotNull(options, nameof(options));
 38            Check.NotNull(requestMapper, nameof(requestMapper));
 39            Check.NotNull(responseMapper, nameof(responseMapper));
 40            Check.NotNull(mappingMatcher, nameof(mappingMatcher));
 41
 42            _options = options;
 43            _requestMapper = requestMapper;
 44            _responseMapper = responseMapper;
 45            _mappingMatcher = mappingMatcher;
 46        }
 47#else
 5148        public WireMockMiddleware(Next next, IWireMockMiddlewareOptions options, IOwinRequestMapper requestMapper, IOwin
 5149        {
 5150            Check.NotNull(options, nameof(options));
 5151            Check.NotNull(requestMapper, nameof(requestMapper));
 5152            Check.NotNull(responseMapper, nameof(responseMapper));
 5153            Check.NotNull(mappingMatcher, nameof(mappingMatcher));
 54
 5155            _options = options;
 5156            _requestMapper = requestMapper;
 5157            _responseMapper = responseMapper;
 5158            _mappingMatcher = mappingMatcher;
 5159        }
 60#endif
 61
 62#if !USE_ASPNETCORE
 63        public override Task Invoke(IContext ctx)
 64#else
 65        public Task Invoke(IContext ctx)
 66#endif
 5067        {
 4968            return InvokeInternal(ctx);
 5069        }
 70
 71        private async Task InvokeInternal(IContext ctx)
 4972        {
 4973            var request = await _requestMapper.MapAsync(ctx.Request);
 74
 4975            bool logRequest = false;
 4976            ResponseMessage response = null;
 4977            (IMapping TargetMapping, RequestMatchResult RequestMatchResult) result = (null, null);
 78            try
 4979            {
 48980                foreach (var mapping in _options.Mappings.Values.Where(m => m?.Scenario != null))
 3081                {
 82                    // Set start
 3083                    if (!_options.Scenarios.ContainsKey(mapping.Scenario) && mapping.IsStartState)
 484                    {
 485                        _options.Scenarios.TryAdd(mapping.Scenario, new ScenarioState
 486                        {
 487                            Name = mapping.Scenario
 488                        });
 489                    }
 3090                }
 91
 5092                result = _mappingMatcher.Match(request);
 5093                var targetMapping = result.TargetMapping;
 94
 5095                if (targetMapping == null)
 1396                {
 1397                    logRequest = true;
 1398                    _options.Logger.Warn("HttpStatusCode set to 404 : No matching mapping found");
 1399                    response = ResponseMessageBuilder.Create("No matching mapping found", 404);
 13100                    return;
 101                }
 102
 37103                logRequest = !targetMapping.IsAdminInterface;
 104
 37105                if (targetMapping.IsAdminInterface && _options.AuthorizationMatcher != null)
 2106                {
 2107                    bool present = request.Headers.TryGetValue(HttpKnownHeaderNames.Authorization, out WireMockList<stri
 2108                    if (!present || _options.AuthorizationMatcher.IsMatch(authorization.ToString()) < MatchScores.Perfec
 2109                    {
 2110                        _options.Logger.Error("HttpStatusCode set to 401");
 2111                        response = ResponseMessageBuilder.Create(null, 401);
 2112                        return;
 113                    }
 0114                }
 115
 35116                if (!targetMapping.IsAdminInterface && _options.RequestProcessingDelay > TimeSpan.Zero)
 1117                {
 1118                    await Task.Delay(_options.RequestProcessingDelay.Value);
 1119                }
 120
 35121                response = await targetMapping.ResponseToAsync(request);
 122
 35123                if (targetMapping.Scenario != null)
 9124                {
 9125                    _options.Scenarios[targetMapping.Scenario].NextState = targetMapping.NextState;
 9126                    _options.Scenarios[targetMapping.Scenario].Started = true;
 9127                    _options.Scenarios[targetMapping.Scenario].Finished = targetMapping.NextState == null;
 9128                }
 35129            }
 0130            catch (Exception ex)
 0131            {
 0132                _options.Logger.Error("HttpStatusCode set to 500");
 0133                response = ResponseMessageBuilder.Create(JsonConvert.SerializeObject(ex), 500);
 0134            }
 135            finally
 50136            {
 50137                var log = new LogEntry
 50138                {
 50139                    Guid = Guid.NewGuid(),
 50140                    RequestMessage = request,
 50141                    ResponseMessage = response,
 50142                    MappingGuid = result.TargetMapping?.Guid,
 50143                    MappingTitle = result.TargetMapping?.Title,
 50144                    RequestMatchResult = result.RequestMatchResult
 50145                };
 146
 50147                LogRequest(log, logRequest);
 148
 50149                await _responseMapper.MapAsync(response, ctx.Response);
 50150            }
 151
 35152            await CompletedTask;
 50153        }
 154
 155        private void LogRequest(LogEntry entry, bool addRequest)
 49156        {
 49157            _options.Logger.DebugRequestResponse(LogEntryMapper.Map(entry), entry.RequestMessage.Path.StartsWith("/__adm
 158
 50159            if (addRequest)
 40160            {
 40161                _options.LogEntries.Add(entry);
 40162            }
 163
 50164            if (_options.MaxRequestLogCount != null)
 3165            {
 3166                var amount = _options.LogEntries.Count - _options.MaxRequestLogCount.Value;
 8167                for (int i = 0; i < amount; i++)
 1168                {
 1169                    _options.LogEntries.RemoveAt(0);
 1170                }
 3171            }
 172
 50173            if (_options.RequestLogExpirationDuration != null)
 1174            {
 1175                var checkTime = DateTime.Now.AddHours(-_options.RequestLogExpirationDuration.Value);
 176
 4177                for (var i = _options.LogEntries.Count - 1; i >= 0; i--)
 1178                {
 1179                    var le = _options.LogEntries[i];
 1180                    if (le.RequestMessage.DateTime <= checkTime)
 1181                    {
 1182                        _options.LogEntries.RemoveAt(i);
 1183                    }
 1184                }
 1185            }
 50186        }
 187    }
 188}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Owin\WireMockMiddleware.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_WireMockMiddlewareOptions.htm b/report/coverlet/WireMock.Net_WireMockMiddlewareOptions.htm index f4c86e0c..461411d7 100644 --- a/report/coverlet/WireMock.Net_WireMockMiddlewareOptions.htm +++ b/report/coverlet/WireMock.Net_WireMockMiddlewareOptions.htm @@ -20,57 +20,14 @@ Covered lines:11 Uncovered lines:0 Coverable lines:11 -Total lines:39 +Total lines:0 Line coverage:100%

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Owin\WireMockMiddlewareOptions.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using System.Collections.Concurrent;
 3using System.Collections.ObjectModel;
 4using WireMock.Logging;
 5using WireMock.Matchers;
 6using WireMock.Util;
 7#if !USE_ASPNETCORE
 8using Owin;
 9#else
 10using IAppBuilder = Microsoft.AspNetCore.Builder.IApplicationBuilder;
 11#endif
 12
 13namespace WireMock.Owin
 14{
 15    internal class WireMockMiddlewareOptions : IWireMockMiddlewareOptions
 16    {
 15117        public IWireMockLogger Logger { get; set; }
 18
 3019        public TimeSpan? RequestProcessingDelay { get; set; }
 20
 1821        public IStringMatcher AuthorizationMatcher { get; set; }
 22
 4923        public bool AllowPartialMapping { get; set; }
 24
 66125        public ConcurrentDictionary<Guid, IMapping> Mappings { get; } = new ConcurrentDictionary<Guid, IMapping>();
 26
 18027        public ConcurrentDictionary<string, ScenarioState> Scenarios { get; } = new ConcurrentDictionary<string, Scenari
 28
 10229        public ObservableCollection<LogEntry> LogEntries { get; } = new ConcurentObservableCollection<LogEntry>();
 30
 5131        public int? RequestLogExpirationDuration { get; set; }
 32
 5333        public int? MaxRequestLogCount { get; set; }
 34
 9435        public Action<IAppBuilder> PreWireMockMiddlewareInit { get; set; }
 36
 9437        public Action<IAppBuilder> PostWireMockMiddlewareInit { get; set; }
 38    }
 39}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Owin\WireMockMiddlewareOptions.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_WireMockNullLogger.htm b/report/coverlet/WireMock.Net_WireMockNullLogger.htm index cb73fcfe..7896e26c 100644 --- a/report/coverlet/WireMock.Net_WireMockNullLogger.htm +++ b/report/coverlet/WireMock.Net_WireMockNullLogger.htm @@ -20,7 +20,7 @@ Covered lines:8 Uncovered lines:2 Coverable lines:10 -Total lines:41 +Total lines:0 Line coverage:80% @@ -37,53 +37,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Logging\WireMockNullLogger.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using WireMock.Admin.Requests;
 2
 3namespace WireMock.Logging
 4{
 5    /// <summary>
 6    /// WireMockNullLogger which does not log.
 7    /// </summary>
 8    /// <seealso cref="IWireMockLogger" />
 9    public class WireMockNullLogger : IWireMockLogger
 10    {
 11        /// <see cref="IWireMockLogger.Debug"/>
 12        public void Debug(string formatString, params object[] args)
 4413        {
 14            // Log nothing
 4415        }
 16
 17        /// <see cref="IWireMockLogger.Info"/>
 18        public void Info(string formatString, params object[] args)
 9519        {
 20            // Log nothing
 9521        }
 22
 23        /// <see cref="IWireMockLogger.Warn"/>
 24        public void Warn(string formatString, params object[] args)
 1125        {
 26            // Log nothing
 1127        }
 28
 29        /// <see cref="IWireMockLogger.Error"/>
 30        public void Error(string formatString, params object[] args)
 031        {
 32            // Log nothing
 033        }
 34
 35        /// <see cref="IWireMockLogger.DebugRequestResponse"/>
 36        public void DebugRequestResponse(LogEntryModel logEntryModel, bool isAdminRequest)
 4637        {
 38            // Log nothing
 4639        }
 40    }
 41}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Logging\WireMockNullLogger.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/WireMock.Net_XPathMatcher.htm b/report/coverlet/WireMock.Net_XPathMatcher.htm index c2c8c975..3495b510 100644 --- a/report/coverlet/WireMock.Net_XPathMatcher.htm +++ b/report/coverlet/WireMock.Net_XPathMatcher.htm @@ -20,7 +20,7 @@ Covered lines:25 Uncovered lines:3 Coverable lines:28 -Total lines:77 +Total lines:0 Line coverage:89.2% Branch coverage:100% @@ -37,89 +37,8 @@

File(s)

C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\XPathMatcher.cs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#LineLine coverage
 1using System;
 2using System.Linq;
 3using System.Xml;
 4using JetBrains.Annotations;
 5using WireMock.Validation;
 6#if !NETSTANDARD1_3
 7using Wmhelp.XPath2;
 8#endif
 9
 10namespace WireMock.Matchers
 11{
 12    /// <summary>
 13    /// XPath2Matcher
 14    /// </summary>
 15    /// <seealso cref="IStringMatcher" />
 16    public class XPathMatcher : IStringMatcher
 17    {
 18        private readonly string[] _patterns;
 19
 20        /// <inheritdoc cref="IMatcher.MatchBehaviour"/>
 421        public MatchBehaviour MatchBehaviour { get; }
 22
 23        /// <summary>
 24        /// Initializes a new instance of the <see cref="XPathMatcher"/> class.
 25        /// </summary>
 26        /// <param name="patterns">The patterns.</param>
 527        public XPathMatcher([NotNull] params string[] patterns) : this(MatchBehaviour.AcceptOnMatch, patterns)
 528        {
 529        }
 30
 31        /// <summary>
 32        /// Initializes a new instance of the <see cref="XPathMatcher"/> class.
 33        /// </summary>
 34        /// <param name="matchBehaviour">The match behaviour.</param>
 35        /// <param name="patterns">The patterns.</param>
 636        public XPathMatcher(MatchBehaviour matchBehaviour, [NotNull] params string[] patterns)
 637        {
 638            Check.NotNull(patterns, nameof(patterns));
 39
 640            MatchBehaviour = matchBehaviour;
 641            _patterns = patterns;
 642        }
 43
 44        /// <inheritdoc cref="IStringMatcher.IsMatch"/>
 45        public double IsMatch(string input)
 446        {
 447            double match = MatchScores.Mismatch;
 448            if (input != null)
 449            {
 50                try
 451                {
 452                    var nav = new XmlDocument { InnerXml = input }.CreateNavigator();
 53#if NETSTANDARD1_3
 54                    match = MatchScores.ToScore(_patterns.Select(p => true.Equals(nav.Evaluate($"boolean({p})"))));
 55#else
 1256                    match = MatchScores.ToScore(_patterns.Select(p => true.Equals(nav.XPath2Evaluate($"boolean({p})"))))
 57#endif
 458                }
 059                catch (Exception)
 060                {
 61                    // just ignore exception
 062                }
 463            }
 64
 465            return MatchBehaviourHelper.Convert(MatchBehaviour, match);
 466        }
 67
 68        /// <inheritdoc cref="IStringMatcher.GetPatterns"/>
 69        public string[] GetPatterns()
 170        {
 171            return _patterns;
 172        }
 73
 74        /// <inheritdoc cref="IMatcher.Name"/>
 175        public string Name => "XPathMatcher";
 76    }
 77}
-
+

File 'C:\Users\StefHeyenrath\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\XPathMatcher.cs' does not exist (any more).

+

Methods/Properties

diff --git a/report/coverlet/combined.js b/report/coverlet/combined.js index b6557c96..5cb2abf4 100644 --- a/report/coverlet/combined.js +++ b/report/coverlet/combined.js @@ -325,104 +325,104 @@ var assemblies = [ { "name": "WireMock.Net", "classes": [ - { "name": "WireMock.Admin.Mappings.BodyModel", "reportPath": "WireMock.Net_BodyModel.htm", "coveredLines": 1, "uncoveredLines": 0, "coverableLines": 1, "totalLines": 13, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Admin.Mappings.ClientIPModel", "reportPath": "WireMock.Net_ClientIPModel.htm", "coveredLines": 0, "uncoveredLines": 1, "coverableLines": 1, "totalLines": 13, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Admin.Mappings.CookieModel", "reportPath": "WireMock.Net_CookieModel.htm", "coveredLines": 0, "uncoveredLines": 2, "coverableLines": 2, "totalLines": 20, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Admin.Mappings.EncodingModel", "reportPath": "WireMock.Net_EncodingModel.htm", "coveredLines": 3, "uncoveredLines": 0, "coverableLines": 3, "totalLines": 23, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Admin.Mappings.HeaderModel", "reportPath": "WireMock.Net_HeaderModel.htm", "coveredLines": 0, "uncoveredLines": 2, "coverableLines": 2, "totalLines": 20, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Admin.Mappings.MappingModel", "reportPath": "WireMock.Net_MappingModel.htm", "coveredLines": 8, "uncoveredLines": 0, "coverableLines": 8, "totalLines": 51, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Admin.Mappings.MatcherModel", "reportPath": "WireMock.Net_MatcherModel.htm", "coveredLines": 5, "uncoveredLines": 0, "coverableLines": 5, "totalLines": 33, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Admin.Mappings.ParamModel", "reportPath": "WireMock.Net_ParamModel.htm", "coveredLines": 0, "uncoveredLines": 2, "coverableLines": 2, "totalLines": 18, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Admin.Mappings.PathModel", "reportPath": "WireMock.Net_PathModel.htm", "coveredLines": 1, "uncoveredLines": 0, "coverableLines": 1, "totalLines": 13, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Admin.Mappings.RequestModel", "reportPath": "WireMock.Net_RequestModel.htm", "coveredLines": 8, "uncoveredLines": 0, "coverableLines": 8, "totalLines": 50, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Admin.Mappings.ResponseModel", "reportPath": "WireMock.Net_ResponseModel.htm", "coveredLines": 16, "uncoveredLines": 0, "coverableLines": 16, "totalLines": 90, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Admin.Mappings.StatusModel", "reportPath": "WireMock.Net_StatusModel.htm", "coveredLines": 2, "uncoveredLines": 0, "coverableLines": 2, "totalLines": 20, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Admin.Mappings.UrlModel", "reportPath": "WireMock.Net_UrlModel.htm", "coveredLines": 0, "uncoveredLines": 1, "coverableLines": 1, "totalLines": 13, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Admin.Requests.LogEntryModel", "reportPath": "WireMock.Net_LogEntryModel.htm", "coveredLines": 6, "uncoveredLines": 0, "coverableLines": 6, "totalLines": 40, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Admin.Requests.LogRequestMatchModel", "reportPath": "WireMock.Net_LogRequestMatchModel.htm", "coveredLines": 5, "uncoveredLines": 0, "coverableLines": 5, "totalLines": 50, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Admin.Requests.LogRequestModel", "reportPath": "WireMock.Net_LogRequestModel.htm", "coveredLines": 14, "uncoveredLines": 0, "coverableLines": 14, "totalLines": 83, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Admin.Requests.LogResponseModel", "reportPath": "WireMock.Net_LogResponseModel.htm", "coveredLines": 10, "uncoveredLines": 0, "coverableLines": 10, "totalLines": 62, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Admin.Scenarios.ScenarioStateModel", "reportPath": "WireMock.Net_ScenarioStateModel.htm", "coveredLines": 0, "uncoveredLines": 4, "coverableLines": 4, "totalLines": 28, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Admin.Settings.SettingsModel", "reportPath": "WireMock.Net_SettingsModel.htm", "coveredLines": 4, "uncoveredLines": 0, "coverableLines": 4, "totalLines": 28, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Handlers.LocalFileSystemHandler", "reportPath": "WireMock.Net_LocalFileSystemHandler.htm", "coveredLines": 20, "uncoveredLines": 5, "coverableLines": 25, "totalLines": 62, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Http.HttpClientHelper", "reportPath": "WireMock.Net_HttpClientHelper.htm", "coveredLines": 14, "uncoveredLines": 14, "coverableLines": 28, "totalLines": 78, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 3, "totalBranches": 10, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Http.HttpRequestMessageHelper", "reportPath": "WireMock.Net_HttpRequestMessageHelper.htm", "coveredLines": 50, "uncoveredLines": 5, "coverableLines": 55, "totalLines": 86, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 34, "totalBranches": 36, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.HttpsCertificate.ClientCertificateHelper", "reportPath": "WireMock.Net_ClientCertificateHelper.htm", "coveredLines": 0, "uncoveredLines": 17, "coverableLines": 17, "totalLines": 42, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 4, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.HttpsCertificate.PublicCertificateHelper", "reportPath": "WireMock.Net_PublicCertificateHelper.htm", "coveredLines": 0, "uncoveredLines": 4, "coverableLines": 4, "totalLines": 91, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Logging.LogEntry", "reportPath": "WireMock.Net_LogEntry.htm", "coveredLines": 6, "uncoveredLines": 0, "coverableLines": 6, "totalLines": 59, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Logging.WireMockConsoleLogger", "reportPath": "WireMock.Net_WireMockConsoleLogger.htm", "coveredLines": 0, "uncoveredLines": 24, "coverableLines": 24, "totalLines": 59, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 2, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Logging.WireMockNullLogger", "reportPath": "WireMock.Net_WireMockNullLogger.htm", "coveredLines": 8, "uncoveredLines": 2, "coverableLines": 10, "totalLines": 41, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Mapping", "reportPath": "WireMock.Net_Mapping.htm", "coveredLines": 36, "uncoveredLines": 0, "coverableLines": 36, "totalLines": 105, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 13, "totalBranches": 14, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Matchers.ExactMatcher", "reportPath": "WireMock.Net_ExactMatcher.htm", "coveredLines": 17, "uncoveredLines": 0, "coverableLines": 17, "totalLines": 54, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Matchers.ExactObjectMatcher", "reportPath": "WireMock.Net_ExactObjectMatcher.htm", "coveredLines": 24, "uncoveredLines": 0, "coverableLines": 24, "totalLines": 71, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 2, "totalBranches": 2, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Matchers.JsonMatcher", "reportPath": "WireMock.Net_JsonMatcher.htm", "coveredLines": 37, "uncoveredLines": 5, "coverableLines": 42, "totalLines": 105, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 10, "totalBranches": 12, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Matchers.JsonPathMatcher", "reportPath": "WireMock.Net_JsonPathMatcher.htm", "coveredLines": 43, "uncoveredLines": 3, "coverableLines": 46, "totalLines": 102, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 9, "totalBranches": 10, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Matchers.LinqMatcher", "reportPath": "WireMock.Net_LinqMatcher.htm", "coveredLines": 36, "uncoveredLines": 0, "coverableLines": 36, "totalLines": 107, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 4, "totalBranches": 4, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Matchers.MatchBehaviourHelper", "reportPath": "WireMock.Net_MatchBehaviourHelper.htm", "coveredLines": 6, "uncoveredLines": 0, "coverableLines": 6, "totalLines": 27, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 4, "totalBranches": 4, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Matchers.MatchScores", "reportPath": "WireMock.Net_MatchScores.htm", "coveredLines": 9, "uncoveredLines": 0, "coverableLines": 9, "totalLines": 61, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 4, "totalBranches": 6, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Matchers.RegexMatcher", "reportPath": "WireMock.Net_RegexMatcher.htm", "coveredLines": 38, "uncoveredLines": 3, "coverableLines": 41, "totalLines": 104, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 4, "totalBranches": 4, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Matchers.Request.RequestMatchResult", "reportPath": "WireMock.Net_RequestMatchResult.htm", "coveredLines": 16, "uncoveredLines": 0, "coverableLines": 16, "totalLines": 82, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 1, "totalBranches": 2, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Matchers.Request.RequestMessageBodyMatcher", "reportPath": "WireMock.Net_RequestMessageBodyMatcher.htm", "coveredLines": 67, "uncoveredLines": 0, "coverableLines": 67, "totalLines": 158, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 23, "totalBranches": 26, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Matchers.Request.RequestMessageClientIPMatcher", "reportPath": "WireMock.Net_RequestMessageClientIPMatcher.htm", "coveredLines": 27, "uncoveredLines": 1, "coverableLines": 28, "totalLines": 75, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 4, "totalBranches": 6, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Matchers.Request.RequestMessageCompositeMatcher", "reportPath": "WireMock.Net_RequestMessageCompositeMatcher.htm", "coveredLines": 16, "uncoveredLines": 0, "coverableLines": 16, "totalLines": 52, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 4, "totalBranches": 4, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Matchers.Request.RequestMessageCookieMatcher", "reportPath": "WireMock.Net_RequestMessageCookieMatcher.htm", "coveredLines": 43, "uncoveredLines": 2, "coverableLines": 45, "totalLines": 111, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 9, "totalBranches": 10, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Matchers.Request.RequestMessageHeaderMatcher", "reportPath": "WireMock.Net_RequestMessageHeaderMatcher.htm", "coveredLines": 52, "uncoveredLines": 2, "coverableLines": 54, "totalLines": 131, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 9, "totalBranches": 10, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Matchers.Request.RequestMessageMethodMatcher", "reportPath": "WireMock.Net_RequestMessageMethodMatcher.htm", "coveredLines": 14, "uncoveredLines": 0, "coverableLines": 14, "totalLines": 45, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Matchers.Request.RequestMessageParamMatcher", "reportPath": "WireMock.Net_RequestMessageParamMatcher.htm", "coveredLines": 46, "uncoveredLines": 1, "coverableLines": 47, "totalLines": 120, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 17, "totalBranches": 20, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Matchers.Request.RequestMessagePathMatcher", "reportPath": "WireMock.Net_RequestMessagePathMatcher.htm", "coveredLines": 27, "uncoveredLines": 1, "coverableLines": 28, "totalLines": 77, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 4, "totalBranches": 6, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Matchers.Request.RequestMessageScenarioAndStateMatcher", "reportPath": "WireMock.Net_RequestMessageScenarioAndStateMatcher.htm", "coveredLines": 12, "uncoveredLines": 0, "coverableLines": 12, "totalLines": 46, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 2, "totalBranches": 2, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Matchers.Request.RequestMessageUrlMatcher", "reportPath": "WireMock.Net_RequestMessageUrlMatcher.htm", "coveredLines": 27, "uncoveredLines": 1, "coverableLines": 28, "totalLines": 75, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 4, "totalBranches": 6, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Matchers.SimMetricsMatcher", "reportPath": "WireMock.Net_SimMetricsMatcher.htm", "coveredLines": 29, "uncoveredLines": 17, "coverableLines": 46, "totalLines": 125, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 2, "totalBranches": 19, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Matchers.WildcardMatcher", "reportPath": "WireMock.Net_WildcardMatcher.htm", "coveredLines": 17, "uncoveredLines": 0, "coverableLines": 17, "totalLines": 63, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 2, "totalBranches": 2, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Matchers.XPathMatcher", "reportPath": "WireMock.Net_XPathMatcher.htm", "coveredLines": 25, "uncoveredLines": 3, "coverableLines": 28, "totalLines": 77, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 2, "totalBranches": 2, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Models.UrlDetails", "reportPath": "WireMock.Net_UrlDetails.htm", "coveredLines": 15, "uncoveredLines": 0, "coverableLines": 15, "totalLines": 51, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Owin.AspNetCoreSelfHost", "reportPath": "WireMock.Net_AspNetCoreSelfHost.htm", "coveredLines": 83, "uncoveredLines": 7, "coverableLines": 90, "totalLines": 159, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 3, "totalBranches": 4, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Owin.GlobalExceptionMiddleware", "reportPath": "WireMock.Net_GlobalExceptionMiddleware.htm", "coveredLines": 17, "uncoveredLines": 5, "coverableLines": 22, "totalLines": 71, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 7, "totalBranches": 12, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Owin.Mappers.OwinRequestMapper", "reportPath": "WireMock.Net_OwinRequestMapper.htm", "coveredLines": 32, "uncoveredLines": 7, "coverableLines": 39, "totalLines": 89, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 10, "totalBranches": 16, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Owin.Mappers.OwinResponseMapper", "reportPath": "WireMock.Net_OwinResponseMapper.htm", "coveredLines": 44, "uncoveredLines": 3, "coverableLines": 47, "totalLines": 100, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 20, "totalBranches": 26, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Owin.MappingMatcher", "reportPath": "WireMock.Net_MappingMatcher.htm", "coveredLines": 27, "uncoveredLines": 0, "coverableLines": 27, "totalLines": 48, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 20, "totalBranches": 22, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Owin.WireMockMiddleware", "reportPath": "WireMock.Net_WireMockMiddleware.htm", "coveredLines": 102, "uncoveredLines": 6, "coverableLines": 108, "totalLines": 188, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 57, "totalBranches": 66, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Owin.WireMockMiddlewareOptions", "reportPath": "WireMock.Net_WireMockMiddlewareOptions.htm", "coveredLines": 11, "uncoveredLines": 0, "coverableLines": 11, "totalLines": 39, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.RequestBuilders.Request", "reportPath": "WireMock.Net_Request.htm", "coveredLines": 208, "uncoveredLines": 6, "coverableLines": 214, "totalLines": 418, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 8, "totalBranches": 8, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.RequestMessage", "reportPath": "WireMock.Net_RequestMessage.htm", "coveredLines": 81, "uncoveredLines": 0, "coverableLines": 81, "totalLines": 212, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 23, "totalBranches": 24, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.ResponseBuilders.Response", "reportPath": "WireMock.Net_Response.htm", "coveredLines": 161, "uncoveredLines": 31, "coverableLines": 192, "totalLines": 414, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 39, "totalBranches": 46, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.ResponseMessage", "reportPath": "WireMock.Net_ResponseMessage.htm", "coveredLines": 18, "uncoveredLines": 3, "coverableLines": 21, "totalLines": 95, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 1, "totalBranches": 2, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.ResponseMessageBuilder", "reportPath": "WireMock.Net_ResponseMessageBuilder.htm", "coveredLines": 11, "uncoveredLines": 0, "coverableLines": 11, "totalLines": 26, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 2, "totalBranches": 2, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.ResponseProviders.DynamicAsyncResponseProvider", "reportPath": "WireMock.Net_DynamicAsyncResponseProvider.htm", "coveredLines": 0, "uncoveredLines": 8, "coverableLines": 8, "totalLines": 24, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.ResponseProviders.DynamicResponseProvider", "reportPath": "WireMock.Net_DynamicResponseProvider.htm", "coveredLines": 8, "uncoveredLines": 0, "coverableLines": 8, "totalLines": 24, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.ResponseProviders.ProxyAsyncResponseProvider", "reportPath": "WireMock.Net_ProxyAsyncResponseProvider.htm", "coveredLines": 7, "uncoveredLines": 3, "coverableLines": 10, "totalLines": 28, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.ScenarioState", "reportPath": "WireMock.Net_ScenarioState.htm", "coveredLines": 4, "uncoveredLines": 0, "coverableLines": 4, "totalLines": 28, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Serialization.LogEntryMapper", "reportPath": "WireMock.Net_LogEntryMapper.htm", "coveredLines": 60, "uncoveredLines": 0, "coverableLines": 60, "totalLines": 72, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 7, "totalBranches": 8, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Serialization.MappingConverter", "reportPath": "WireMock.Net_MappingConverter.htm", "coveredLines": 87, "uncoveredLines": 29, "coverableLines": 116, "totalLines": 142, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 34, "totalBranches": 70, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Serialization.MatcherMapper", "reportPath": "WireMock.Net_MatcherMapper.htm", "coveredLines": 43, "uncoveredLines": 3, "coverableLines": 46, "totalLines": 96, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 59, "totalBranches": 68, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Server.FluentMockServer", "reportPath": "WireMock.Net_FluentMockServer.htm", "coveredLines": 392, "uncoveredLines": 344, "coverableLines": 736, "totalLines": 1317, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 130, "totalBranches": 244, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Server.RespondWithAProvider", "reportPath": "WireMock.Net_RespondWithAProvider.htm", "coveredLines": 42, "uncoveredLines": 4, "coverableLines": 46, "totalLines": 115, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 2, "totalBranches": 4, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Settings.FluentMockServerSettings", "reportPath": "WireMock.Net_FluentMockServerSettings.htm", "coveredLines": 17, "uncoveredLines": 0, "coverableLines": 17, "totalLines": 87, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Settings.ProxyAndRecordSettings", "reportPath": "WireMock.Net_ProxyAndRecordSettings.htm", "coveredLines": 5, "uncoveredLines": 0, "coverableLines": 5, "totalLines": 30, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Transformers.HandlebarsHelpers", "reportPath": "WireMock.Net_HandlebarsHelpers.htm", "coveredLines": 5, "uncoveredLines": 0, "coverableLines": 5, "totalLines": 14, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Transformers.HandleBarsJsonPath", "reportPath": "WireMock.Net_HandleBarsJsonPath.htm", "coveredLines": 44, "uncoveredLines": 1, "coverableLines": 45, "totalLines": 73, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 10, "totalBranches": 14, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Transformers.HandleBarsLinq", "reportPath": "WireMock.Net_HandleBarsLinq.htm", "coveredLines": 48, "uncoveredLines": 0, "coverableLines": 48, "totalLines": 86, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 13, "totalBranches": 14, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Transformers.HandleBarsRegex", "reportPath": "WireMock.Net_HandleBarsRegex.htm", "coveredLines": 43, "uncoveredLines": 0, "coverableLines": 43, "totalLines": 66, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 11, "totalBranches": 12, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Transformers.ResponseMessageTransformer", "reportPath": "WireMock.Net_ResponseMessageTransformer.htm", "coveredLines": 78, "uncoveredLines": 4, "coverableLines": 82, "totalLines": 135, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 26, "totalBranches": 28, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Util.BodyData", "reportPath": "WireMock.Net_BodyData.htm", "coveredLines": 4, "uncoveredLines": 0, "coverableLines": 4, "totalLines": 30, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Util.BodyParser", "reportPath": "WireMock.Net_BodyParser.htm", "coveredLines": 39, "uncoveredLines": 17, "coverableLines": 56, "totalLines": 88, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 11, "totalBranches": 28, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Util.ConcurentObservableCollection`1", "reportPath": "WireMock.Net_ConcurentObservableCollection_1.htm", "coveredLines": 20, "uncoveredLines": 14, "coverableLines": 34, "totalLines": 77, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Util.DictionaryExtensions", "reportPath": "WireMock.Net_DictionaryExtensions.htm", "coveredLines": 0, "uncoveredLines": 10, "coverableLines": 10, "totalLines": 33, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 4, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Util.EnhancedFileSystemWatcher", "reportPath": "WireMock.Net_EnhancedFileSystemWatcher.htm", "coveredLines": 0, "uncoveredLines": 87, "coverableLines": 87, "totalLines": 254, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 26, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Util.FileHelper", "reportPath": "WireMock.Net_FileHelper.htm", "coveredLines": 14, "uncoveredLines": 0, "coverableLines": 14, "totalLines": 34, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 2, "totalBranches": 2, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Util.JsonUtils", "reportPath": "WireMock.Net_JsonUtils.htm", "coveredLines": 84, "uncoveredLines": 0, "coverableLines": 84, "totalLines": 147, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 33, "totalBranches": 33, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Util.PortUtils", "reportPath": "WireMock.Net_PortUtils.htm", "coveredLines": 23, "uncoveredLines": 0, "coverableLines": 23, "totalLines": 55, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 4, "totalBranches": 4, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Util.RegexUtils", "reportPath": "WireMock.Net_RegexUtils.htm", "coveredLines": 12, "uncoveredLines": 0, "coverableLines": 12, "totalLines": 24, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 4, "totalBranches": 4, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Util.UrlUtils", "reportPath": "WireMock.Net_UrlUtils.htm", "coveredLines": 15, "uncoveredLines": 0, "coverableLines": 15, "totalLines": 38, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 4, "totalBranches": 4, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Util.WireMockList`1", "reportPath": "WireMock.Net_WireMockList_1.htm", "coveredLines": 9, "uncoveredLines": 3, "coverableLines": 12, "totalLines": 44, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 1, "totalBranches": 2, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Validation.Check", "reportPath": "WireMock.Net_Check.htm", "coveredLines": 39, "uncoveredLines": 32, "coverableLines": 71, "totalLines": 139, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 13, "totalBranches": 24, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Validation.CoreStrings", "reportPath": "WireMock.Net_CoreStrings.htm", "coveredLines": 0, "uncoveredLines": 12, "coverableLines": 12, "totalLines": 41, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Admin.Mappings.BodyModel", "reportPath": "WireMock.Net_BodyModel.htm", "coveredLines": 1, "uncoveredLines": 0, "coverableLines": 1, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Admin.Mappings.ClientIPModel", "reportPath": "WireMock.Net_ClientIPModel.htm", "coveredLines": 0, "uncoveredLines": 1, "coverableLines": 1, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Admin.Mappings.CookieModel", "reportPath": "WireMock.Net_CookieModel.htm", "coveredLines": 0, "uncoveredLines": 2, "coverableLines": 2, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Admin.Mappings.EncodingModel", "reportPath": "WireMock.Net_EncodingModel.htm", "coveredLines": 3, "uncoveredLines": 0, "coverableLines": 3, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Admin.Mappings.HeaderModel", "reportPath": "WireMock.Net_HeaderModel.htm", "coveredLines": 0, "uncoveredLines": 2, "coverableLines": 2, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Admin.Mappings.MappingModel", "reportPath": "WireMock.Net_MappingModel.htm", "coveredLines": 8, "uncoveredLines": 0, "coverableLines": 8, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Admin.Mappings.MatcherModel", "reportPath": "WireMock.Net_MatcherModel.htm", "coveredLines": 5, "uncoveredLines": 0, "coverableLines": 5, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Admin.Mappings.ParamModel", "reportPath": "WireMock.Net_ParamModel.htm", "coveredLines": 0, "uncoveredLines": 2, "coverableLines": 2, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Admin.Mappings.PathModel", "reportPath": "WireMock.Net_PathModel.htm", "coveredLines": 1, "uncoveredLines": 0, "coverableLines": 1, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Admin.Mappings.RequestModel", "reportPath": "WireMock.Net_RequestModel.htm", "coveredLines": 8, "uncoveredLines": 0, "coverableLines": 8, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Admin.Mappings.ResponseModel", "reportPath": "WireMock.Net_ResponseModel.htm", "coveredLines": 16, "uncoveredLines": 0, "coverableLines": 16, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Admin.Mappings.StatusModel", "reportPath": "WireMock.Net_StatusModel.htm", "coveredLines": 2, "uncoveredLines": 0, "coverableLines": 2, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Admin.Mappings.UrlModel", "reportPath": "WireMock.Net_UrlModel.htm", "coveredLines": 0, "uncoveredLines": 1, "coverableLines": 1, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Admin.Requests.LogEntryModel", "reportPath": "WireMock.Net_LogEntryModel.htm", "coveredLines": 6, "uncoveredLines": 0, "coverableLines": 6, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Admin.Requests.LogRequestMatchModel", "reportPath": "WireMock.Net_LogRequestMatchModel.htm", "coveredLines": 5, "uncoveredLines": 0, "coverableLines": 5, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Admin.Requests.LogRequestModel", "reportPath": "WireMock.Net_LogRequestModel.htm", "coveredLines": 14, "uncoveredLines": 0, "coverableLines": 14, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Admin.Requests.LogResponseModel", "reportPath": "WireMock.Net_LogResponseModel.htm", "coveredLines": 10, "uncoveredLines": 0, "coverableLines": 10, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Admin.Scenarios.ScenarioStateModel", "reportPath": "WireMock.Net_ScenarioStateModel.htm", "coveredLines": 0, "uncoveredLines": 4, "coverableLines": 4, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Admin.Settings.SettingsModel", "reportPath": "WireMock.Net_SettingsModel.htm", "coveredLines": 4, "uncoveredLines": 0, "coverableLines": 4, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Handlers.LocalFileSystemHandler", "reportPath": "WireMock.Net_LocalFileSystemHandler.htm", "coveredLines": 20, "uncoveredLines": 5, "coverableLines": 25, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Http.HttpClientHelper", "reportPath": "WireMock.Net_HttpClientHelper.htm", "coveredLines": 14, "uncoveredLines": 14, "coverableLines": 28, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 3, "totalBranches": 10, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Http.HttpRequestMessageHelper", "reportPath": "WireMock.Net_HttpRequestMessageHelper.htm", "coveredLines": 50, "uncoveredLines": 5, "coverableLines": 55, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 34, "totalBranches": 36, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.HttpsCertificate.ClientCertificateHelper", "reportPath": "WireMock.Net_ClientCertificateHelper.htm", "coveredLines": 0, "uncoveredLines": 17, "coverableLines": 17, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 4, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.HttpsCertificate.PublicCertificateHelper", "reportPath": "WireMock.Net_PublicCertificateHelper.htm", "coveredLines": 0, "uncoveredLines": 4, "coverableLines": 4, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Logging.LogEntry", "reportPath": "WireMock.Net_LogEntry.htm", "coveredLines": 6, "uncoveredLines": 0, "coverableLines": 6, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Logging.WireMockConsoleLogger", "reportPath": "WireMock.Net_WireMockConsoleLogger.htm", "coveredLines": 0, "uncoveredLines": 24, "coverableLines": 24, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 2, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Logging.WireMockNullLogger", "reportPath": "WireMock.Net_WireMockNullLogger.htm", "coveredLines": 8, "uncoveredLines": 2, "coverableLines": 10, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Mapping", "reportPath": "WireMock.Net_Mapping.htm", "coveredLines": 36, "uncoveredLines": 0, "coverableLines": 36, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 13, "totalBranches": 14, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Matchers.ExactMatcher", "reportPath": "WireMock.Net_ExactMatcher.htm", "coveredLines": 17, "uncoveredLines": 0, "coverableLines": 17, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Matchers.ExactObjectMatcher", "reportPath": "WireMock.Net_ExactObjectMatcher.htm", "coveredLines": 24, "uncoveredLines": 0, "coverableLines": 24, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 2, "totalBranches": 2, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Matchers.JsonMatcher", "reportPath": "WireMock.Net_JsonMatcher.htm", "coveredLines": 37, "uncoveredLines": 5, "coverableLines": 42, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 10, "totalBranches": 12, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Matchers.JsonPathMatcher", "reportPath": "WireMock.Net_JsonPathMatcher.htm", "coveredLines": 43, "uncoveredLines": 3, "coverableLines": 46, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 9, "totalBranches": 10, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Matchers.LinqMatcher", "reportPath": "WireMock.Net_LinqMatcher.htm", "coveredLines": 36, "uncoveredLines": 0, "coverableLines": 36, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 4, "totalBranches": 4, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Matchers.MatchBehaviourHelper", "reportPath": "WireMock.Net_MatchBehaviourHelper.htm", "coveredLines": 6, "uncoveredLines": 0, "coverableLines": 6, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 4, "totalBranches": 4, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Matchers.MatchScores", "reportPath": "WireMock.Net_MatchScores.htm", "coveredLines": 9, "uncoveredLines": 0, "coverableLines": 9, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 4, "totalBranches": 6, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Matchers.RegexMatcher", "reportPath": "WireMock.Net_RegexMatcher.htm", "coveredLines": 38, "uncoveredLines": 3, "coverableLines": 41, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 4, "totalBranches": 4, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Matchers.Request.RequestMatchResult", "reportPath": "WireMock.Net_RequestMatchResult.htm", "coveredLines": 16, "uncoveredLines": 0, "coverableLines": 16, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 1, "totalBranches": 2, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Matchers.Request.RequestMessageBodyMatcher", "reportPath": "WireMock.Net_RequestMessageBodyMatcher.htm", "coveredLines": 67, "uncoveredLines": 0, "coverableLines": 67, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 23, "totalBranches": 26, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Matchers.Request.RequestMessageClientIPMatcher", "reportPath": "WireMock.Net_RequestMessageClientIPMatcher.htm", "coveredLines": 27, "uncoveredLines": 1, "coverableLines": 28, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 4, "totalBranches": 6, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Matchers.Request.RequestMessageCompositeMatcher", "reportPath": "WireMock.Net_RequestMessageCompositeMatcher.htm", "coveredLines": 16, "uncoveredLines": 0, "coverableLines": 16, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 4, "totalBranches": 4, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Matchers.Request.RequestMessageCookieMatcher", "reportPath": "WireMock.Net_RequestMessageCookieMatcher.htm", "coveredLines": 43, "uncoveredLines": 2, "coverableLines": 45, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 9, "totalBranches": 10, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Matchers.Request.RequestMessageHeaderMatcher", "reportPath": "WireMock.Net_RequestMessageHeaderMatcher.htm", "coveredLines": 52, "uncoveredLines": 2, "coverableLines": 54, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 9, "totalBranches": 10, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Matchers.Request.RequestMessageMethodMatcher", "reportPath": "WireMock.Net_RequestMessageMethodMatcher.htm", "coveredLines": 14, "uncoveredLines": 0, "coverableLines": 14, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Matchers.Request.RequestMessageParamMatcher", "reportPath": "WireMock.Net_RequestMessageParamMatcher.htm", "coveredLines": 46, "uncoveredLines": 1, "coverableLines": 47, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 17, "totalBranches": 20, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Matchers.Request.RequestMessagePathMatcher", "reportPath": "WireMock.Net_RequestMessagePathMatcher.htm", "coveredLines": 27, "uncoveredLines": 1, "coverableLines": 28, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 4, "totalBranches": 6, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Matchers.Request.RequestMessageScenarioAndStateMatcher", "reportPath": "WireMock.Net_RequestMessageScenarioAndStateMatcher.htm", "coveredLines": 12, "uncoveredLines": 0, "coverableLines": 12, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 2, "totalBranches": 2, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Matchers.Request.RequestMessageUrlMatcher", "reportPath": "WireMock.Net_RequestMessageUrlMatcher.htm", "coveredLines": 27, "uncoveredLines": 1, "coverableLines": 28, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 4, "totalBranches": 6, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Matchers.SimMetricsMatcher", "reportPath": "WireMock.Net_SimMetricsMatcher.htm", "coveredLines": 29, "uncoveredLines": 17, "coverableLines": 46, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 2, "totalBranches": 19, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Matchers.WildcardMatcher", "reportPath": "WireMock.Net_WildcardMatcher.htm", "coveredLines": 17, "uncoveredLines": 0, "coverableLines": 17, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 2, "totalBranches": 2, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Matchers.XPathMatcher", "reportPath": "WireMock.Net_XPathMatcher.htm", "coveredLines": 25, "uncoveredLines": 3, "coverableLines": 28, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 2, "totalBranches": 2, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Models.UrlDetails", "reportPath": "WireMock.Net_UrlDetails.htm", "coveredLines": 15, "uncoveredLines": 0, "coverableLines": 15, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Owin.AspNetCoreSelfHost", "reportPath": "WireMock.Net_AspNetCoreSelfHost.htm", "coveredLines": 83, "uncoveredLines": 7, "coverableLines": 90, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 3, "totalBranches": 4, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Owin.GlobalExceptionMiddleware", "reportPath": "WireMock.Net_GlobalExceptionMiddleware.htm", "coveredLines": 17, "uncoveredLines": 5, "coverableLines": 22, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 7, "totalBranches": 12, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Owin.Mappers.OwinRequestMapper", "reportPath": "WireMock.Net_OwinRequestMapper.htm", "coveredLines": 32, "uncoveredLines": 7, "coverableLines": 39, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 10, "totalBranches": 16, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Owin.Mappers.OwinResponseMapper", "reportPath": "WireMock.Net_OwinResponseMapper.htm", "coveredLines": 44, "uncoveredLines": 3, "coverableLines": 47, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 20, "totalBranches": 26, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Owin.MappingMatcher", "reportPath": "WireMock.Net_MappingMatcher.htm", "coveredLines": 27, "uncoveredLines": 0, "coverableLines": 27, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 20, "totalBranches": 22, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Owin.WireMockMiddleware", "reportPath": "WireMock.Net_WireMockMiddleware.htm", "coveredLines": 102, "uncoveredLines": 6, "coverableLines": 108, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 57, "totalBranches": 66, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Owin.WireMockMiddlewareOptions", "reportPath": "WireMock.Net_WireMockMiddlewareOptions.htm", "coveredLines": 11, "uncoveredLines": 0, "coverableLines": 11, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.RequestBuilders.Request", "reportPath": "WireMock.Net_Request.htm", "coveredLines": 208, "uncoveredLines": 6, "coverableLines": 214, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 8, "totalBranches": 8, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.RequestMessage", "reportPath": "WireMock.Net_RequestMessage.htm", "coveredLines": 81, "uncoveredLines": 0, "coverableLines": 81, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 23, "totalBranches": 24, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.ResponseBuilders.Response", "reportPath": "WireMock.Net_Response.htm", "coveredLines": 161, "uncoveredLines": 31, "coverableLines": 192, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 39, "totalBranches": 46, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.ResponseMessage", "reportPath": "WireMock.Net_ResponseMessage.htm", "coveredLines": 18, "uncoveredLines": 3, "coverableLines": 21, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 1, "totalBranches": 2, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.ResponseMessageBuilder", "reportPath": "WireMock.Net_ResponseMessageBuilder.htm", "coveredLines": 11, "uncoveredLines": 0, "coverableLines": 11, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 2, "totalBranches": 2, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.ResponseProviders.DynamicAsyncResponseProvider", "reportPath": "WireMock.Net_DynamicAsyncResponseProvider.htm", "coveredLines": 0, "uncoveredLines": 8, "coverableLines": 8, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.ResponseProviders.DynamicResponseProvider", "reportPath": "WireMock.Net_DynamicResponseProvider.htm", "coveredLines": 8, "uncoveredLines": 0, "coverableLines": 8, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.ResponseProviders.ProxyAsyncResponseProvider", "reportPath": "WireMock.Net_ProxyAsyncResponseProvider.htm", "coveredLines": 7, "uncoveredLines": 3, "coverableLines": 10, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.ScenarioState", "reportPath": "WireMock.Net_ScenarioState.htm", "coveredLines": 4, "uncoveredLines": 0, "coverableLines": 4, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Serialization.LogEntryMapper", "reportPath": "WireMock.Net_LogEntryMapper.htm", "coveredLines": 60, "uncoveredLines": 0, "coverableLines": 60, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 7, "totalBranches": 8, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Serialization.MappingConverter", "reportPath": "WireMock.Net_MappingConverter.htm", "coveredLines": 87, "uncoveredLines": 29, "coverableLines": 116, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 34, "totalBranches": 70, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Serialization.MatcherMapper", "reportPath": "WireMock.Net_MatcherMapper.htm", "coveredLines": 43, "uncoveredLines": 3, "coverableLines": 46, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 59, "totalBranches": 68, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Server.FluentMockServer", "reportPath": "WireMock.Net_FluentMockServer.htm", "coveredLines": 392, "uncoveredLines": 344, "coverableLines": 736, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 130, "totalBranches": 244, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Server.RespondWithAProvider", "reportPath": "WireMock.Net_RespondWithAProvider.htm", "coveredLines": 42, "uncoveredLines": 4, "coverableLines": 46, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 2, "totalBranches": 4, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Settings.FluentMockServerSettings", "reportPath": "WireMock.Net_FluentMockServerSettings.htm", "coveredLines": 17, "uncoveredLines": 0, "coverableLines": 17, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Settings.ProxyAndRecordSettings", "reportPath": "WireMock.Net_ProxyAndRecordSettings.htm", "coveredLines": 5, "uncoveredLines": 0, "coverableLines": 5, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Transformers.HandlebarsHelpers", "reportPath": "WireMock.Net_HandlebarsHelpers.htm", "coveredLines": 5, "uncoveredLines": 0, "coverableLines": 5, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Transformers.HandleBarsJsonPath", "reportPath": "WireMock.Net_HandleBarsJsonPath.htm", "coveredLines": 44, "uncoveredLines": 1, "coverableLines": 45, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 10, "totalBranches": 14, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Transformers.HandleBarsLinq", "reportPath": "WireMock.Net_HandleBarsLinq.htm", "coveredLines": 48, "uncoveredLines": 0, "coverableLines": 48, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 13, "totalBranches": 14, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Transformers.HandleBarsRegex", "reportPath": "WireMock.Net_HandleBarsRegex.htm", "coveredLines": 43, "uncoveredLines": 0, "coverableLines": 43, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 11, "totalBranches": 12, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Transformers.ResponseMessageTransformer", "reportPath": "WireMock.Net_ResponseMessageTransformer.htm", "coveredLines": 78, "uncoveredLines": 4, "coverableLines": 82, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 26, "totalBranches": 28, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Util.BodyData", "reportPath": "WireMock.Net_BodyData.htm", "coveredLines": 4, "uncoveredLines": 0, "coverableLines": 4, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Util.BodyParser", "reportPath": "WireMock.Net_BodyParser.htm", "coveredLines": 39, "uncoveredLines": 17, "coverableLines": 56, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 11, "totalBranches": 28, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Util.ConcurentObservableCollection`1", "reportPath": "WireMock.Net_ConcurentObservableCollection_1.htm", "coveredLines": 20, "uncoveredLines": 14, "coverableLines": 34, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Util.DictionaryExtensions", "reportPath": "WireMock.Net_DictionaryExtensions.htm", "coveredLines": 0, "uncoveredLines": 10, "coverableLines": 10, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 4, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Util.EnhancedFileSystemWatcher", "reportPath": "WireMock.Net_EnhancedFileSystemWatcher.htm", "coveredLines": 0, "uncoveredLines": 87, "coverableLines": 87, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 26, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Util.FileHelper", "reportPath": "WireMock.Net_FileHelper.htm", "coveredLines": 14, "uncoveredLines": 0, "coverableLines": 14, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 2, "totalBranches": 2, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Util.JsonUtils", "reportPath": "WireMock.Net_JsonUtils.htm", "coveredLines": 84, "uncoveredLines": 0, "coverableLines": 84, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 33, "totalBranches": 33, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Util.PortUtils", "reportPath": "WireMock.Net_PortUtils.htm", "coveredLines": 23, "uncoveredLines": 0, "coverableLines": 23, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 4, "totalBranches": 4, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Util.RegexUtils", "reportPath": "WireMock.Net_RegexUtils.htm", "coveredLines": 12, "uncoveredLines": 0, "coverableLines": 12, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 4, "totalBranches": 4, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Util.UrlUtils", "reportPath": "WireMock.Net_UrlUtils.htm", "coveredLines": 15, "uncoveredLines": 0, "coverableLines": 15, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 4, "totalBranches": 4, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Util.WireMockList`1", "reportPath": "WireMock.Net_WireMockList_1.htm", "coveredLines": 9, "uncoveredLines": 3, "coverableLines": 12, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 1, "totalBranches": 2, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Validation.Check", "reportPath": "WireMock.Net_Check.htm", "coveredLines": 39, "uncoveredLines": 32, "coverableLines": 71, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 13, "totalBranches": 24, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Validation.CoreStrings", "reportPath": "WireMock.Net_CoreStrings.htm", "coveredLines": 0, "uncoveredLines": 12, "coverableLines": 12, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 0, "lineCoverageHistory": [], "branchCoverageHistory": [] }, ]}, { "name": "WireMock.Net.StandAlone", "classes": [ - { "name": "WireMock.Net.StandAlone.SimpleCommandLineParser", "reportPath": "WireMock.Net.StandAlone_SimpleCommandLineParser.htm", "coveredLines": 66, "uncoveredLines": 6, "coverableLines": 72, "totalLines": 115, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 17, "totalBranches": 20, "lineCoverageHistory": [], "branchCoverageHistory": [] }, - { "name": "WireMock.Net.StandAlone.StandAloneApp", "reportPath": "WireMock.Net.StandAlone_StandAloneApp.htm", "coveredLines": 0, "uncoveredLines": 48, "coverableLines": 48, "totalLines": 90, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 8, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Net.StandAlone.SimpleCommandLineParser", "reportPath": "WireMock.Net.StandAlone_SimpleCommandLineParser.htm", "coveredLines": 66, "uncoveredLines": 6, "coverableLines": 72, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 17, "totalBranches": 20, "lineCoverageHistory": [], "branchCoverageHistory": [] }, + { "name": "WireMock.Net.StandAlone.StandAloneApp", "reportPath": "WireMock.Net.StandAlone_StandAloneApp.htm", "coveredLines": 0, "uncoveredLines": 48, "coverableLines": 48, "totalLines": 0, "coverageType": "LineCoverage", "methodCoverage": "-", "coveredBranches": 0, "totalBranches": 8, "lineCoverageHistory": [], "branchCoverageHistory": [] }, ]}, ]; diff --git a/report/coverlet/index.htm b/report/coverlet/index.htm index c18db6a6..7a5b2ef3 100644 --- a/report/coverlet/index.htm +++ b/report/coverlet/index.htm @@ -14,7 +14,7 @@ -Generated on:2018-10-09 - 12:23:37 +Generated on:16-8-2019 - 18:01:12 Parser:OpenCoverParser Assemblies:2 Classes:94 @@ -22,7 +22,7 @@ Covered lines:2863 Uncovered lines:815 Coverable lines:3678 -Total lines:8615 +Total lines:0 Line coverage:77.8% Branch coverage:69.1% @@ -46,104 +46,104 @@ NameCoveredUncoveredCoverableTotalLine coverageBranch coverage -WireMock.Net27977613558841078.6%
  
69.3%
  
-WireMock.Admin.Mappings.BodyModel10113100%
 
 
-WireMock.Admin.Mappings.ClientIPModel011130%
 
 
-WireMock.Admin.Mappings.CookieModel022200%
 
 
-WireMock.Admin.Mappings.EncodingModel30323100%
 
 
-WireMock.Admin.Mappings.HeaderModel022200%
 
 
-WireMock.Admin.Mappings.MappingModel80851100%
 
 
-WireMock.Admin.Mappings.MatcherModel50533100%
 
 
-WireMock.Admin.Mappings.ParamModel022180%
 
 
-WireMock.Admin.Mappings.PathModel10113100%
 
 
-WireMock.Admin.Mappings.RequestModel80850100%
 
 
-WireMock.Admin.Mappings.ResponseModel1601690100%
 
 
-WireMock.Admin.Mappings.StatusModel20220100%
 
 
-WireMock.Admin.Mappings.UrlModel011130%
 
 
-WireMock.Admin.Requests.LogEntryModel60640100%
 
 
-WireMock.Admin.Requests.LogRequestMatchModel50550100%
 
 
-WireMock.Admin.Requests.LogRequestModel1401483100%
 
 
-WireMock.Admin.Requests.LogResponseModel1001062100%
 
 
-WireMock.Admin.Scenarios.ScenarioStateModel044280%
 
 
-WireMock.Admin.Settings.SettingsModel40428100%
 
 
-WireMock.Handlers.LocalFileSystemHandler205256280%
  
 
-WireMock.Http.HttpClientHelper1414287850%
  
30%
  
-WireMock.Http.HttpRequestMessageHelper505558690.9%
  
94.4%
  
-WireMock.HttpsCertificate.ClientCertificateHelper01717420%
 
0%
 
-WireMock.HttpsCertificate.PublicCertificateHelper044910%
 
 
-WireMock.Logging.LogEntry60659100%
 
 
-WireMock.Logging.WireMockConsoleLogger02424590%
 
0%
 
-WireMock.Logging.WireMockNullLogger82104180%
  
 
-WireMock.Mapping36036105100%
 
92.8%
  
-WireMock.Matchers.ExactMatcher1701754100%
 
 
-WireMock.Matchers.ExactObjectMatcher2402471100%
 
100%
 
-WireMock.Matchers.JsonMatcher3754210588%
  
83.3%
  
-WireMock.Matchers.JsonPathMatcher4334610293.4%
  
90%
  
-WireMock.Matchers.LinqMatcher36036107100%
 
100%
 
-WireMock.Matchers.MatchBehaviourHelper60627100%
 
100%
 
-WireMock.Matchers.MatchScores90961100%
 
66.6%
  
-WireMock.Matchers.RegexMatcher3834110492.6%
  
100%
 
-WireMock.Matchers.Request.RequestMatchResult1601682100%
 
50%
  
-WireMock.Matchers.Request.RequestMessageBodyMatcher67067158100%
 
88.4%
  
-WireMock.Matchers.Request.RequestMessageClientIPMatcher271287596.4%
  
66.6%
  
-WireMock.Matchers.Request.RequestMessageCompositeMatcher1601652100%
 
100%
 
-WireMock.Matchers.Request.RequestMessageCookieMatcher4324511195.5%
  
90%
  
-WireMock.Matchers.Request.RequestMessageHeaderMatcher5225413196.2%
  
90%
  
-WireMock.Matchers.Request.RequestMessageMethodMatcher1401445100%
 
 
-WireMock.Matchers.Request.RequestMessageParamMatcher4614712097.8%
  
85%
  
-WireMock.Matchers.Request.RequestMessagePathMatcher271287796.4%
  
66.6%
  
-WireMock.Matchers.Request.RequestMessageScenarioAndStateMatcher1201246100%
 
100%
 
-WireMock.Matchers.Request.RequestMessageUrlMatcher271287596.4%
  
66.6%
  
-WireMock.Matchers.SimMetricsMatcher29174612563%
  
10.5%
  
-WireMock.Matchers.WildcardMatcher1701763100%
 
100%
 
-WireMock.Matchers.XPathMatcher253287789.2%
  
100%
 
-WireMock.Models.UrlDetails1501551100%
 
 
-WireMock.Owin.AspNetCoreSelfHost8379015992.2%
  
75%
  
-WireMock.Owin.GlobalExceptionMiddleware175227177.2%
  
58.3%
  
-WireMock.Owin.Mappers.OwinRequestMapper327398982%
  
62.5%
  
-WireMock.Owin.Mappers.OwinResponseMapper4434710093.6%
  
76.9%
  
-WireMock.Owin.MappingMatcher2702748100%
 
90.9%
  
-WireMock.Owin.WireMockMiddleware102610818894.4%
  
86.3%
  
-WireMock.Owin.WireMockMiddlewareOptions1101139100%
 
 
-WireMock.RequestBuilders.Request208621441897.1%
  
100%
 
-WireMock.RequestMessage81081212100%
 
95.8%
  
-WireMock.ResponseBuilders.Response1613119241483.8%
  
84.7%
  
-WireMock.ResponseMessage183219585.7%
  
50%
  
-WireMock.ResponseMessageBuilder1101126100%
 
100%
 
-WireMock.ResponseProviders.DynamicAsyncResponseProvider088240%
 
 
-WireMock.ResponseProviders.DynamicResponseProvider80824100%
 
 
-WireMock.ResponseProviders.ProxyAsyncResponseProvider73102870%
  
 
-WireMock.ScenarioState40428100%
 
 
-WireMock.Serialization.LogEntryMapper6006072100%
 
87.5%
  
-WireMock.Serialization.MappingConverter872911614275%
  
48.5%
  
-WireMock.Serialization.MatcherMapper433469693.4%
  
86.7%
  
-WireMock.Server.FluentMockServer392344736131753.2%
  
53.2%
  
-WireMock.Server.RespondWithAProvider4244611591.3%
  
50%
  
-WireMock.Settings.FluentMockServerSettings1701787100%
 
 
-WireMock.Settings.ProxyAndRecordSettings50530100%
 
 
-WireMock.Transformers.HandlebarsHelpers50514100%
 
 
-WireMock.Transformers.HandleBarsJsonPath441457397.7%
  
71.4%
  
-WireMock.Transformers.HandleBarsLinq4804886100%
 
92.8%
  
-WireMock.Transformers.HandleBarsRegex4304366100%
 
91.6%
  
-WireMock.Transformers.ResponseMessageTransformer7848213595.1%
  
92.8%
  
-WireMock.Util.BodyData40430100%
 
 
-WireMock.Util.BodyParser3917568869.6%
  
39.2%
  
-WireMock.Util.ConcurentObservableCollection`12014347758.8%
  
 
-WireMock.Util.DictionaryExtensions01010330%
 
0%
 
-WireMock.Util.EnhancedFileSystemWatcher087872540%
 
0%
 
-WireMock.Util.FileHelper1401434100%
 
100%
 
-WireMock.Util.JsonUtils84084147100%
 
100%
 
-WireMock.Util.PortUtils2302355100%
 
100%
 
-WireMock.Util.RegexUtils1201224100%
 
100%
 
-WireMock.Util.UrlUtils1501538100%
 
100%
 
-WireMock.Util.WireMockList`193124475%
  
50%
  
-WireMock.Validation.Check39327113954.9%
  
54.1%
  
-WireMock.Validation.CoreStrings01212410%
 
 
-WireMock.Net.StandAlone665412020555%
  
60.7%
  
-WireMock.Net.StandAlone.SimpleCommandLineParser6667211591.6%
  
85%
  
-WireMock.Net.StandAlone.StandAloneApp04848900%
 
0%
 
+WireMock.Net27977613558078.6%
  
69.3%
  
+WireMock.Admin.Mappings.BodyModel1010100%
 
 
+WireMock.Admin.Mappings.ClientIPModel01100%
 
 
+WireMock.Admin.Mappings.CookieModel02200%
 
 
+WireMock.Admin.Mappings.EncodingModel3030100%
 
 
+WireMock.Admin.Mappings.HeaderModel02200%
 
 
+WireMock.Admin.Mappings.MappingModel8080100%
 
 
+WireMock.Admin.Mappings.MatcherModel5050100%
 
 
+WireMock.Admin.Mappings.ParamModel02200%
 
 
+WireMock.Admin.Mappings.PathModel1010100%
 
 
+WireMock.Admin.Mappings.RequestModel8080100%
 
 
+WireMock.Admin.Mappings.ResponseModel160160100%
 
 
+WireMock.Admin.Mappings.StatusModel2020100%
 
 
+WireMock.Admin.Mappings.UrlModel01100%
 
 
+WireMock.Admin.Requests.LogEntryModel6060100%
 
 
+WireMock.Admin.Requests.LogRequestMatchModel5050100%
 
 
+WireMock.Admin.Requests.LogRequestModel140140100%
 
 
+WireMock.Admin.Requests.LogResponseModel100100100%
 
 
+WireMock.Admin.Scenarios.ScenarioStateModel04400%
 
 
+WireMock.Admin.Settings.SettingsModel4040100%
 
 
+WireMock.Handlers.LocalFileSystemHandler20525080%
  
 
+WireMock.Http.HttpClientHelper141428050%
  
30%
  
+WireMock.Http.HttpRequestMessageHelper50555090.9%
  
94.4%
  
+WireMock.HttpsCertificate.ClientCertificateHelper0171700%
 
0%
 
+WireMock.HttpsCertificate.PublicCertificateHelper04400%
 
 
+WireMock.Logging.LogEntry6060100%
 
 
+WireMock.Logging.WireMockConsoleLogger0242400%
 
0%
 
+WireMock.Logging.WireMockNullLogger8210080%
  
 
+WireMock.Mapping360360100%
 
92.8%
  
+WireMock.Matchers.ExactMatcher170170100%
 
 
+WireMock.Matchers.ExactObjectMatcher240240100%
 
100%
 
+WireMock.Matchers.JsonMatcher37542088%
  
83.3%
  
+WireMock.Matchers.JsonPathMatcher43346093.4%
  
90%
  
+WireMock.Matchers.LinqMatcher360360100%
 
100%
 
+WireMock.Matchers.MatchBehaviourHelper6060100%
 
100%
 
+WireMock.Matchers.MatchScores9090100%
 
66.6%
  
+WireMock.Matchers.RegexMatcher38341092.6%
  
100%
 
+WireMock.Matchers.Request.RequestMatchResult160160100%
 
50%
  
+WireMock.Matchers.Request.RequestMessageBodyMatcher670670100%
 
88.4%
  
+WireMock.Matchers.Request.RequestMessageClientIPMatcher27128096.4%
  
66.6%
  
+WireMock.Matchers.Request.RequestMessageCompositeMatcher160160100%
 
100%
 
+WireMock.Matchers.Request.RequestMessageCookieMatcher43245095.5%
  
90%
  
+WireMock.Matchers.Request.RequestMessageHeaderMatcher52254096.2%
  
90%
  
+WireMock.Matchers.Request.RequestMessageMethodMatcher140140100%
 
 
+WireMock.Matchers.Request.RequestMessageParamMatcher46147097.8%
  
85%
  
+WireMock.Matchers.Request.RequestMessagePathMatcher27128096.4%
  
66.6%
  
+WireMock.Matchers.Request.RequestMessageScenarioAndStateMatcher120120100%
 
100%
 
+WireMock.Matchers.Request.RequestMessageUrlMatcher27128096.4%
  
66.6%
  
+WireMock.Matchers.SimMetricsMatcher291746063%
  
10.5%
  
+WireMock.Matchers.WildcardMatcher170170100%
 
100%
 
+WireMock.Matchers.XPathMatcher25328089.2%
  
100%
 
+WireMock.Models.UrlDetails150150100%
 
 
+WireMock.Owin.AspNetCoreSelfHost83790092.2%
  
75%
  
+WireMock.Owin.GlobalExceptionMiddleware17522077.2%
  
58.3%
  
+WireMock.Owin.Mappers.OwinRequestMapper32739082%
  
62.5%
  
+WireMock.Owin.Mappers.OwinResponseMapper44347093.6%
  
76.9%
  
+WireMock.Owin.MappingMatcher270270100%
 
90.9%
  
+WireMock.Owin.WireMockMiddleware1026108094.4%
  
86.3%
  
+WireMock.Owin.WireMockMiddlewareOptions110110100%
 
 
+WireMock.RequestBuilders.Request2086214097.1%
  
100%
 
+WireMock.RequestMessage810810100%
 
95.8%
  
+WireMock.ResponseBuilders.Response16131192083.8%
  
84.7%
  
+WireMock.ResponseMessage18321085.7%
  
50%
  
+WireMock.ResponseMessageBuilder110110100%
 
100%
 
+WireMock.ResponseProviders.DynamicAsyncResponseProvider08800%
 
 
+WireMock.ResponseProviders.DynamicResponseProvider8080100%
 
 
+WireMock.ResponseProviders.ProxyAsyncResponseProvider7310070%
  
 
+WireMock.ScenarioState4040100%
 
 
+WireMock.Serialization.LogEntryMapper600600100%
 
87.5%
  
+WireMock.Serialization.MappingConverter8729116075%
  
48.5%
  
+WireMock.Serialization.MatcherMapper43346093.4%
  
86.7%
  
+WireMock.Server.FluentMockServer392344736053.2%
  
53.2%
  
+WireMock.Server.RespondWithAProvider42446091.3%
  
50%
  
+WireMock.Settings.FluentMockServerSettings170170100%
 
 
+WireMock.Settings.ProxyAndRecordSettings5050100%
 
 
+WireMock.Transformers.HandlebarsHelpers5050100%
 
 
+WireMock.Transformers.HandleBarsJsonPath44145097.7%
  
71.4%
  
+WireMock.Transformers.HandleBarsLinq480480100%
 
92.8%
  
+WireMock.Transformers.HandleBarsRegex430430100%
 
91.6%
  
+WireMock.Transformers.ResponseMessageTransformer78482095.1%
  
92.8%
  
+WireMock.Util.BodyData4040100%
 
 
+WireMock.Util.BodyParser391756069.6%
  
39.2%
  
+WireMock.Util.ConcurentObservableCollection`1201434058.8%
  
 
+WireMock.Util.DictionaryExtensions0101000%
 
0%
 
+WireMock.Util.EnhancedFileSystemWatcher0878700%
 
0%
 
+WireMock.Util.FileHelper140140100%
 
100%
 
+WireMock.Util.JsonUtils840840100%
 
100%
 
+WireMock.Util.PortUtils230230100%
 
100%
 
+WireMock.Util.RegexUtils120120100%
 
100%
 
+WireMock.Util.UrlUtils150150100%
 
100%
 
+WireMock.Util.WireMockList`19312075%
  
50%
  
+WireMock.Validation.Check393271054.9%
  
54.1%
  
+WireMock.Validation.CoreStrings0121200%
 
 
+WireMock.Net.StandAlone6654120055%
  
60.7%
  
+WireMock.Net.StandAlone.SimpleCommandLineParser66672091.6%
  
85%
  
+WireMock.Net.StandAlone.StandAloneApp0484800%
 
0%
 
-
+ \ No newline at end of file diff --git a/report/run-codecov-local.cmd b/report/run-codecov-local.cmd deleted file mode 100644 index 5c662c85..00000000 --- a/report/run-codecov-local.cmd +++ /dev/null @@ -1,10 +0,0 @@ -rem TODO -rem https://www.appveyor.com/blog/2017/03/17/codecov/ - -rem dotnet build .\test\WireMock.Net.Tests\WireMock.Net.Tests.csproj -c Debug - -rem USERPROFILE%\.nuget\packages\opencover\4.6.519\tools\OpenCover.Console.exe -target:dotnet.exe -targetargs:"test test\WireMock.Net.Tests\WireMock.Net.Tests.csproj --no-build" -filter:"+[WireMock.Net]* -[WireMock.Net.Tests*]*" -output:coverage.xml -register:user -oldStyle -searchdirs:"test\WireMock.Net.Tests\bin\debug\net452" - -rem %USERPROFILE%\.nuget\packages\ReportGenerator\2.5.6\tools\ReportGenerator.exe -reports:"coverage.xml" -targetdir:"report\opencover" - -rem start report\index.htm \ No newline at end of file