# Summary

Class: | WireMock.Matchers.Request.RequestMessageClientIPMatcher
Assembly: | WireMock.Net
File(s): | C:\Users\azureuser\Documents\Github\WireMock.Net\src\WireMock.Net\Matchers\Request\RequestMessageClientIPMatcher.cs
Covered lines: | 27
Uncovered lines: | 1
Coverable lines: | 28
Total lines: | 74
Line coverage: | 96.4%
Branch coverage: | 75%

# Metrics

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

# File(s)

## C:\Users\azureuser\Documents\Github\WireMock.Net\src\WireMock.Net\Matchers\Request\RequestMessageClientIPMatcher.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 ClientIP matcher.`
|  | `11` |  | `/// </summary>`
|  | `12` |  | `public class RequestMessageClientIPMatcher : IRequestMatcher`
|  | `13` |  | `{`
|  | `14` |  | `/// <summary>`
|  | `15` |  | `/// The matchers.`
|  | `16` |  | `/// </summary>`
| 7 | `17` |  | `public IReadOnlyList<IStringMatcher> Matchers { get; }`
|  | `18` |  | ``
|  | `19` |  | `/// <summary>`
|  | `20` |  | `/// The ClientIP functions.`
|  | `21` |  | `/// </summary>`
| 2 | `22` |  | `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>`
| 5 | `28` |  | `public RequestMessageClientIPMatcher([NotNull] params string[] clientIPs) : this(clientIPs.Select(ip => new Wild`
| 2 | `29` |  | `{`
| 2 | `30` |  | `}`
|  | `31` |  | ``
|  | `32` |  | `/// <summary>`
|  | `33` |  | `/// Initializes a new instance of the <see cref="RequestMessageClientIPMatcher"/> class.`
|  | `34` |  | `/// </summary>`
|  | `35` |  | `/// <param name="matchers">The matchers.</param>`
| 3 | `36` |  | `public RequestMessageClientIPMatcher([NotNull] params IStringMatcher[] matchers)`
| 3 | `37` |  | `{`
| 3 | `38` |  | `Check.NotNull(matchers, nameof(matchers));`
| 3 | `39` |  | `Matchers = matchers;`
| 3 | `40` |  | `}`
|  | `41` |  | ``
|  | `42` |  | `/// <summary>`
|  | `43` |  | `/// Initializes a new instance of the <see cref="RequestMessageClientIPMatcher"/> class.`
|  | `44` |  | `/// </summary>`
|  | `45` |  | `/// <param name="funcs">The clientIP functions.</param>`
| 1 | `46` |  | `public RequestMessageClientIPMatcher([NotNull] params Func<string, bool>[] funcs)`
| 1 | `47` |  | `{`
| 1 | `48` |  | `Check.NotNull(funcs, nameof(funcs));`
| 1 | `49` |  | `Funcs = funcs;`
| 1 | `50` |  | `}`
|  | `51` |  | ``
|  | `52` |  | `/// <inheritdoc cref="IRequestMatcher.GetMatchingScore"/>`
|  | `53` |  | `public double GetMatchingScore(RequestMessage requestMessage, RequestMatchResult requestMatchResult)`
| 4 | `54` |  | `{`
| 4 | `55` |  | `double score = IsMatch(requestMessage);`
| 4 | `56` |  | `return requestMatchResult.AddScore(GetType(), score);`
| 4 | `57` |  | `}`
|  | `58` |  | ``
|  | `59` |  | `private double IsMatch(RequestMessage requestMessage)`
| 4 | `60` |  | `{`
| 4 | `61` |  | `if (Matchers != null)`
| 3 | `62` |  | `{`
| 7 | `63` |  | `return Matchers.Max(matcher => matcher.IsMatch(requestMessage.ClientIP));`
|  | `64` |  | `}`
|  | `65` |  | ``
| 1 | `66` |  | `if (Funcs != null)`
| 1 | `67` |  | `{`
| 2 | `68` |  | `return MatchScores.ToScore(requestMessage.ClientIP != null && Funcs.Any(func => func(requestMessage.Clie`
|  | `69` |  | `}`
|  | `70` |  | ``
| 0 | `71` |  | `return MatchScores.Mismatch;`
| 4 | `72` |  | `}`
|  | `73` |  | `}`
|  | `74` |  | `}`

# Methods/Properties

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