# Summary

Class: | WireMock.Matchers.Request.RequestMessageUrlMatcher
Assembly: | WireMock.Net
File(s): | C:\Users\Stef\Documents\GitHub\WireMock.Net\src\WireMock.Net\Matchers\Request\RequestMessageUrlMatcher.cs
Covered lines: | 19
Uncovered lines: | 9
Coverable lines: | 28
Total lines: | 81
Line coverage: | 67.8%
Branch coverage: | 25%

# Metrics

Method | Cyclomatic complexity | NPath complexity | Sequence coverage | Branch coverage
--- | --- | --- | --- | ---
.ctor(...) | 2 | 0 | 100 | 100
.ctor(...) | 1 | 0 | 100 | 100
.ctor(...) | 1 | 0 | 0 | 0
GetMatchingScore(...) | 1 | 0 | 100 | 100
IsMatch(...) | 4 | 4 | 57.14 | 40

# File(s)

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

| # | Line |  | Line coverage
--- | --- | --- | --- | ---
|  | `1` |  | `using System;`
|  | `2` |  | `using System.Collections.Generic;`
|  | `3` |  | `using System.Linq;`
|  | `4` |  | `using JetBrains.Annotations;`
|  | `5` |  | `using WireMock.Validation;`
|  | `6` |  | ``
|  | `7` |  | `namespace WireMock.Matchers.Request`
|  | `8` |  | `{`
|  | `9` |  | `/// <summary>`
|  | `10` |  | `/// The request url matcher.`
|  | `11` |  | `/// </summary>`
|  | `12` |  | `public class RequestMessageUrlMatcher : IRequestMatcher`
|  | `13` |  | `{`
|  | `14` |  | `/// <summary>`
|  | `15` |  | `/// The matcher.`
|  | `16` |  | `/// </summary>`
| 2 | `17` |  | `public IReadOnlyList<IMatcher> Matchers { get; }`
|  | `18` |  | ``
|  | `19` |  | `/// <summary>`
|  | `20` |  | `/// The url functions`
|  | `21` |  | `/// </summary>`
| 0 | `22` |  | `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="urls">The urls.</param>`
| 2 | `28` |  | `public RequestMessageUrlMatcher([NotNull] params string[] urls) : this(urls.Select(url => new WildcardMatcher(ur`
| 1 | `29` |  | `{`
| 1 | `30` |  | `}`
|  | `31` |  | ``
|  | `32` |  | `/// <summary>`
|  | `33` |  | `/// Initializes a new instance of the <see cref="RequestMessageUrlMatcher"/> class.`
|  | `34` |  | `/// </summary>`
|  | `35` |  | `/// <param name="matchers">The matchers.</param>`
| 1 | `36` |  | `public RequestMessageUrlMatcher([NotNull] params IMatcher[] matchers)`
| 1 | `37` |  | `{`
| 1 | `38` |  | `Check.NotNull(matchers, nameof(matchers));`
| 1 | `39` |  | `Matchers = matchers;`
| 1 | `40` |  | `}`
|  | `41` |  | ``
|  | `42` |  | `/// <summary>`
|  | `43` |  | `/// Initializes a new instance of the <see cref="RequestMessageUrlMatcher"/> class.`
|  | `44` |  | `/// </summary>`
|  | `45` |  | `/// <param name="funcs">The url functions.</param>`
| 0 | `46` |  | `public RequestMessageUrlMatcher([NotNull] params Func<string, bool>[] funcs)`
| 0 | `47` |  | `{`
| 0 | `48` |  | `Check.NotNull(funcs, nameof(funcs));`
| 0 | `49` |  | `Funcs = funcs;`
| 0 | `50` |  | `}`
|  | `51` |  | ``
|  | `52` |  | `/// <summary>`
|  | `53` |  | `/// Determines whether the specified RequestMessage is match.`
|  | `54` |  | `/// </summary>`
|  | `55` |  | `/// <param name="requestMessage">The RequestMessage.</param>`
|  | `56` |  | `/// <param name="requestMatchResult">The RequestMatchResult.</param>`
|  | `57` |  | `/// <returns>`
|  | `58` |  | `/// A value between 0.0 - 1.0 of the similarity.`
|  | `59` |  | `/// </returns>`
|  | `60` |  | `public double GetMatchingScore(RequestMessage requestMessage, RequestMatchResult requestMatchResult)`
| 1 | `61` |  | `{`
| 1 | `62` |  | `double score = IsMatch(requestMessage);`
| 1 | `63` |  | `requestMatchResult.TotalScore += score;`
|  | `64` |  | ``
| 1 | `65` |  | `requestMatchResult.TotalNumber++;`
|  | `66` |  | ``
| 1 | `67` |  | `return score;`
| 1 | `68` |  | `}`
|  | `69` |  | ``
|  | `70` |  | `private double IsMatch(RequestMessage requestMessage)`
| 1 | `71` |  | `{`
| 1 | `72` |  | `if (Matchers != null)`
| 2 | `73` |  | `return Matchers.Max(matcher => matcher.IsMatch(requestMessage.Url));`
|  | `74` |  | ``
| 0 | `75` |  | `if (Funcs != null)`
| 0 | `76` |  | `return MatchScores.ToScore(requestMessage.Url != null && Funcs.Any(func => func(requestMessage.Url)));`
|  | `77` |  | ``
| 0 | `78` |  | `return MatchScores.Mismatch;`
| 1 | `79` |  | `}`
|  | `80` |  | `}`
|  | `81` |  | `}`

# Methods/Properties

Matchers()
Funcs()
.ctor(System.String[])
.ctor(WireMock.Matchers.IMatcher[])
.ctor(System.Func`2<System.String,System.Boolean>[])
GetMatchingScore(WireMock.RequestMessage,WireMock.Matchers.Request.RequestMatchResult)
IsMatch(WireMock.RequestMessage)