Summary

Class:WireMock.Matchers.Request.RequestMessageCompositeMatcher
Assembly:WireMock.Net
File(s):C:\Users\StefHeyenrath\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
GetMatchingScore(...)0011
.ctor(...)0010

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}