Summary

Class:WireMock.Matchers.Request.RequestMessageCompositeMatcher
Assembly:WireMock.Net
File(s):C:\Users\azureuser\Documents\Github\WireMock.Net\src\WireMock.Net\Matchers\Request\RequestMessageCompositeMatcher.cs
Covered lines:16
Uncovered lines:0
Coverable lines:16
Total lines:52
Line coverage:100%
Branch coverage:100%

Metrics

MethodCyclomatic complexity  NPath complexity  Sequence coverage  Branch coverage  
.ctor(...)10100100
GetMatchingScore(...)34100100

File(s)

C:\Users\azureuser\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>
 40121        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>
 15528        protected RequestMessageCompositeMatcher([NotNull] IEnumerable<IRequestMatcher> requestMatchers, CompositeMatche
 15529        {
 15530            Check.NotNull(requestMatchers, nameof(requestMatchers));
 31
 15532            _type = type;
 15533            RequestMatchers = requestMatchers;
 15534        }
 35
 36        /// <inheritdoc cref="IRequestMatcher.GetMatchingScore"/>
 37        public double GetMatchingScore(RequestMessage requestMessage, RequestMatchResult requestMatchResult)
 20138        {
 20139             if (!RequestMatchers.Any())
 140            {
 141                return MatchScores.Mismatch;
 42            }
 43
 20044             if (_type == CompositeMatcherType.And)
 19945            {
 55746                return RequestMatchers.Average(requestMatcher => requestMatcher.GetMatchingScore(requestMessage, request
 47            }
 48
 349            return RequestMatchers.Max(requestMatcher => requestMatcher.GetMatchingScore(requestMessage, requestMatchRes
 20150        }
 51    }
 52}