# WireMock.Mapping - Coverage Report

# Summary

Class: | WireMock.Mapping
Assembly: | WireMock.Net
File(s): | C:\Users\azureuser\Documents\Github\WireMock.Net\src\WireMock.Net\Mapping.cs
Covered lines: | 36
Uncovered lines: | 0
Coverable lines: | 36
Total lines: | 140
Line coverage: | 100%
Branch coverage: | 100%

# Metrics

Method | Cyclomatic complexity | NPath complexity | Sequence coverage | Branch coverage
--- | --- | --- | --- | ---
.ctor(...) | 1 | 0 | 100 | 100
GetRequestMatchResult(...) | 2 | 2 | 100 | 100
ResponseToAsync() | 3 | 0 | 100 | 100

# File(s)

## C:\Users\azureuser\Documents\Github\WireMock.Net\src\WireMock.Net\Mapping.cs

| # | Line |  | Line coverage
--- | --- | --- | --- | ---
|  | `1` |  | `using System;`
|  | `2` |  | `using System.Threading.Tasks;`
|  | `3` |  | `using JetBrains.Annotations;`
|  | `4` |  | `using WireMock.Matchers.Request;`
|  | `5` |  | `using WireMock.ResponseProviders;`
|  | `6` |  | ``
|  | `7` |  | `namespace WireMock`
|  | `8` |  | `{`
|  | `9` |  | `/// <summary>`
|  | `10` |  | `/// The Mapping.`
|  | `11` |  | `/// </summary>`
|  | `12` |  | `public class Mapping`
|  | `13` |  | `{`
|  | `14` |  | `/// <summary>`
|  | `15` |  | `/// Gets the unique identifier.`
|  | `16` |  | `/// </summary>`
| 259 | `17` |  | `public Guid Guid { get; }`
|  | `18` |  | ``
|  | `19` |  | `/// <summary>`
|  | `20` |  | `/// Gets the unique title.`
|  | `21` |  | `/// </summary>`
| 50 | `22` |  | `public string Title { get; }`
|  | `23` |  | ``
|  | `24` |  | `/// <summary>`
|  | `25` |  | `/// The full filename path for this mapping (only defined for static mappings).`
|  | `26` |  | `/// </summary>`
| 106 | `27` |  | `public string Path { get; set; }`
|  | `28` |  | ``
|  | `29` |  | `/// <summary>`
|  | `30` |  | `/// Gets the priority.`
|  | `31` |  | `/// </summary>`
| 171 | `32` |  | `public int Priority { get; }`
|  | `33` |  | ``
|  | `34` |  | `/// <summary>`
|  | `35` |  | `/// Scenario.`
|  | `36` |  | `/// </summary>`
|  | `37` |  | `[CanBeNull]`
| 551 | `38` |  | `public string Scenario { get; }`
|  | `39` |  | ``
|  | `40` |  | `/// <summary>`
|  | `41` |  | `/// Execution state condition for the current mapping.`
|  | `42` |  | `/// </summary>`
|  | `43` |  | `[CanBeNull]`
| 17 | `44` |  | `public object ExecutionConditionState { get; }`
|  | `45` |  | ``
|  | `46` |  | `/// <summary>`
|  | `47` |  | `/// The next state which will be signaled after the current mapping execution.`
|  | `48` |  | `/// In case the value is null state will not be changed.`
|  | `49` |  | `/// </summary>`
|  | `50` |  | `[CanBeNull]`
| 9 | `51` |  | `public object NextState { get; }`
|  | `52` |  | ``
|  | `53` |  | `/// <summary>`
|  | `54` |  | `/// The Request matcher.`
|  | `55` |  | `/// </summary>`
| 153 | `56` |  | `public IRequestMatcher RequestMatcher { get; }`
|  | `57` |  | ``
|  | `58` |  | `/// <summary>`
|  | `59` |  | `/// The Provider.`
|  | `60` |  | `/// </summary>`
| 449 | `61` |  | `public IResponseProvider Provider { get; }`
|  | `62` |  | ``
|  | `63` |  | `/// <summary>`
|  | `64` |  | `/// Is State started ?`
|  | `65` |  | `/// </summary>`
| 3 | `66` |  | `public bool IsStartState => Scenario == null || Scenario != null && NextState != null && ExecutionConditionState`
|  | `67` |  | ``
|  | `68` |  | `/// <summary>`
|  | `69` |  | `/// Initializes a new instance of the <see cref="Mapping"/> class.`
|  | `70` |  | `/// </summary>`
|  | `71` |  | `/// <param name="guid">The unique identifier.</param>`
|  | `72` |  | `/// <param name="title">The unique title (can be null).</param>`
|  | `73` |  | `/// <param name="path">The full file path from this mapping title (can be null).</param>`
|  | `74` |  | `/// <param name="requestMatcher">The request matcher.</param>`
|  | `75` |  | `/// <param name="provider">The provider.</param>`
|  | `76` |  | `/// <param name="priority">The priority for this mapping.</param>`
|  | `77` |  | `/// <param name="scenario">The scenario. [Optional]</param>`
|  | `78` |  | `/// <param name="executionConditionState">State in which the current mapping can occur. [Optional]</param>`
|  | `79` |  | `/// <param name="nextState">The next state which will occur after the current mapping execution. [Optional]</par`
| 106 | `80` |  | `public Mapping(Guid guid, [CanBeNull] string title, [CanBeNull] string path, IRequestMatcher requestMatcher, IRe`
| 106 | `81` |  | `{`
| 106 | `82` |  | `Guid = guid;`
| 106 | `83` |  | `Title = title;`
| 106 | `84` |  | `Path = path;`
| 106 | `85` |  | `RequestMatcher = requestMatcher;`
| 106 | `86` |  | `Provider = provider;`
| 106 | `87` |  | `Priority = priority;`
| 106 | `88` |  | `Scenario = scenario;`
| 106 | `89` |  | `ExecutionConditionState = executionConditionState;`
| 106 | `90` |  | `NextState = nextState;`
| 106 | `91` |  | `}`
|  | `92` |  | ``
|  | `93` |  | `/// <summary>`
|  | `94` |  | `/// The response to.`
|  | `95` |  | `/// </summary>`
|  | `96` |  | `/// <param name="requestMessage">The request message.</param>`
|  | `97` |  | `/// <returns>The <see cref="ResponseMessage"/>.</returns>`
|  | `98` |  | `public async Task<ResponseMessage> ResponseToAsync(RequestMessage requestMessage)`
| 46 | `99` |  | `{`
| 46 | `100` |  | `return await Provider.ProvideResponseAsync(requestMessage);`
| 46 | `101` |  | `}`
|  | `102` |  | ``
|  | `103` |  | `/// <summary>`
|  | `104` |  | `/// Gets the RequestMatchResult based on the RequestMessage.`
|  | `105` |  | `/// </summary>`
|  | `106` |  | `/// <param name="requestMessage">The request message.</param>`
|  | `107` |  | `/// <param name="nextState">The Next State.</param>`
|  | `108` |  | `/// <returns>The <see cref="RequestMatchResult"/>.</returns>`
|  | `109` |  | `public RequestMatchResult GetRequestMatchResult(RequestMessage requestMessage, [CanBeNull] object nextState)`
| 150 | `110` |  | `{`
| 150 | `111` |  | `var result = new RequestMatchResult();`
|  | `112` |  | ``
| 150 | `113` |  | `RequestMatcher.GetMatchingScore(requestMessage, result);`
|  | `114` |  | ``
|  | `115` |  | `// Only check state if Scenario is defined`
| 150 | `116` |  | `if (Scenario != null)`
| 14 | `117` |  | `{`
| 14 | `118` |  | `var matcher = new RequestMessageScenarioAndStateMatcher(nextState, ExecutionConditionState);`
| 14 | `119` |  | `matcher.GetMatchingScore(requestMessage, result);`
|  | `120` |  | `//// If ExecutionConditionState is null, this means that request is the start from a scenario. So just r`
|  | `121` |  | `//if (ExecutionConditionState != null)`
|  | `122` |  | `//{`
|  | `123` |  | `// // ExecutionConditionState is not null, so get score for matching with the nextState.`
|  | `124` |  | `// var matcher = new RequestMessageScenarioAndStateMatcher(nextState, ExecutionConditionState);`
|  | `125` |  | `// matcher.GetMatchingScore(requestMessage, result);`
|  | `126` |  | `//}`
| 14 | `127` |  | `}`
|  | `128` |  | ``
| 150 | `129` |  | `return result;`
| 150 | `130` |  | `}`
|  | `131` |  | ``
|  | `132` |  | `/// <summary>`
|  | `133` |  | `/// Gets a value indicating whether this mapping is an Admin Interface.`
|  | `134` |  | `/// </summary>`
|  | `135` |  | `/// <value>`
|  | `136` |  | `/// <c>true</c> if this mapping is an Admin Interface; otherwise, <c>false</c>.`
|  | `137` |  | `/// </value>`
| 139 | `138` |  | `public bool IsAdminInterface => Provider is DynamicResponseProvider || Provider is DynamicAsyncResponseProvider`
|  | `139` |  | `}`
|  | `140` |  | `}`

# Methods/Properties

Guid()
Title()
Path()
Path(System.String)
Priority()
Scenario()
ExecutionConditionState()
NextState()
RequestMatcher()
Provider()
IsStartState()
.ctor(System.Guid,System.String,System.String,WireMock.Matchers.Request.IRequestMatcher,WireMock.ResponseProviders.IResponseProvider,System.Int32,System.String,System.Object,System.Object)
ResponseToAsync()
GetRequestMatchResult(WireMock.RequestMessage,System.Object)
IsAdminInterface()