# Summary

Class: | WireMock.Matchers.Request.RequestMessageCompositeMatcher
Assembly: | WireMock.Net
File(s): | C:\Users\Stef\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\Request\RequestMessageCompositeMatcher.cs
Covered lines: | 18
Uncovered lines: | 6
Coverable lines: | 24
Total lines: | 67
Line coverage: | 75%
Branch coverage: | 50%

# Metrics

Method | Cyclomatic complexity | NPath complexity | Sequence coverage | Branch coverage
--- | --- | --- | --- | ---
.ctor(...) | 1 | 0 | 100 | 100
GetMatchingScore(...) | 6 | 2 | 60.87 | 66.67

# File(s)

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

| # | Line |  | Line coverage
--- | --- | --- | --- | ---
|  | `1` |  | `using System.Collections.Generic;`
|  | `2` |  | `using System.Linq;`
|  | `3` |  | `using JetBrains.Annotations;`
|  | `4` |  | `using WireMock.Validation;`
|  | `5` |  | ``
|  | `6` |  | `namespace 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>`
| 48 | `21` |  | `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>`
| 53 | `28` |  | `protected RequestMessageCompositeMatcher([NotNull] IEnumerable<IRequestMatcher> requestMatchers, CompositeMatche`
| 53 | `29` |  | `{`
| 53 | `30` |  | `Check.NotNull(requestMatchers, nameof(requestMatchers));`
|  | `31` |  | ``
| 53 | `32` |  | `_type = type;`
| 53 | `33` |  | `RequestMatchers = requestMatchers;`
| 53 | `34` |  | `}`
|  | `35` |  | ``
|  | `36` |  | `/// <summary>`
|  | `37` |  | `/// Determines whether the specified RequestMessage is match.`
|  | `38` |  | `/// </summary>`
|  | `39` |  | `/// <param name="requestMessage">The RequestMessage.</param>`
|  | `40` |  | `/// <param name="requestMatchResult">The RequestMatchResult.</param>`
|  | `41` |  | `/// <returns>`
|  | `42` |  | `/// A value between 0.0 - 1.0 of the similarity.`
|  | `43` |  | `/// </returns>`
|  | `44` |  | `public double GetMatchingScore(RequestMessage requestMessage, RequestMatchResult requestMatchResult)`
| 48 | `45` |  | `{`
| 48 | `46` |  | `var list = new List<double>();`
| 48 | `47` |  | `if (_type == CompositeMatcherType.And)`
| 48 | `48` |  | `{`
| 274 | `49` |  | `foreach (var requestMatcher in RequestMatchers)`
| 65 | `50` |  | `{`
| 65 | `51` |  | `double score = requestMatcher.GetMatchingScore(requestMessage, requestMatchResult);`
| 65 | `52` |  | `list.Add(score);`
| 65 | `53` |  | `}`
|  | `54` |  | ``
| 48 | `55` |  | `return list.Sum() / list.Count;`
|  | `56` |  | `}`
|  | `57` |  | ``
| 0 | `58` |  | `foreach (var requestMatcher in RequestMatchers)`
| 0 | `59` |  | `{`
| 0 | `60` |  | `double score = requestMatcher.GetMatchingScore(requestMessage, requestMatchResult);`
| 0 | `61` |  | `list.Add(score);`
| 0 | `62` |  | `}`
|  | `63` |  | ``
| 0 | `64` |  | `return list.Max();`
| 48 | `65` |  | `}`
|  | `66` |  | `}`
|  | `67` |  | `}`

# Methods/Properties

RequestMatchers()
.ctor(System.Collections.Generic.IEnumerable`1<WireMock.Matchers.Request.IRequestMatcher>,WireMock.Matchers.Request.CompositeMatcherType)
GetMatchingScore(WireMock.RequestMessage,WireMock.Matchers.Request.RequestMatchResult)