# 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: | 92.8%

# Metrics

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

# 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>`
| 587 | `17` |  | `public Guid Guid { get; }`
|  | `18` |  | ``
|  | `19` |  | `/// <summary>`
|  | `20` |  | `/// Gets the unique title.`
|  | `21` |  | `/// </summary>`
| 58 | `22` |  | `public string Title { get; }`
|  | `23` |  | ``
|  | `24` |  | `/// <summary>`
|  | `25` |  | `/// The full filename path for this mapping (only defined for static mappings).`
|  | `26` |  | `/// </summary>`
| 265 | `27` |  | `public string Path { get; set; }`
|  | `28` |  | ``
|  | `29` |  | `/// <summary>`
|  | `30` |  | `/// Gets the priority.`
|  | `31` |  | `/// </summary>`
| 134 | `32` |  | `public int Priority { get; }`
|  | `33` |  | ``
|  | `34` |  | `/// <summary>`
|  | `35` |  | `/// Scenario.`
|  | `36` |  | `/// </summary>`
|  | `37` |  | `[CanBeNull]`
| 1076 | `38` |  | `public string Scenario { get; }`
|  | `39` |  | ``
|  | `40` |  | `/// <summary>`
|  | `41` |  | `/// Execution state condition for the current mapping.`
|  | `42` |  | `/// </summary>`
|  | `43` |  | `[CanBeNull]`
| 37 | `44` |  | `public string 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]`
| 27 | `51` |  | `public string NextState { get; }`
|  | `52` |  | ``
|  | `53` |  | `/// <summary>`
|  | `54` |  | `/// The Request matcher.`
|  | `55` |  | `/// </summary>`
| 300 | `56` |  | `public IRequestMatcher RequestMatcher { get; }`
|  | `57` |  | ``
|  | `58` |  | `/// <summary>`
|  | `59` |  | `/// The Provider.`
|  | `60` |  | `/// </summary>`
| 507 | `61` |  | `public IResponseProvider Provider { get; }`
|  | `62` |  | ``
|  | `63` |  | `/// <summary>`
|  | `64` |  | `/// Is State started ?`
|  | `65` |  | `/// </summary>`
| 7 | `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`
| 265 | `80` |  | `public Mapping(Guid guid, [CanBeNull] string title, [CanBeNull] string path, IRequestMatcher requestMatcher, IRe`
| 265 | `81` |  | `{`
| 265 | `82` |  | `Guid = guid;`
| 265 | `83` |  | `Title = title;`
| 265 | `84` |  | `Path = path;`
| 265 | `85` |  | `RequestMatcher = requestMatcher;`
| 265 | `86` |  | `Provider = provider;`
| 265 | `87` |  | `Priority = priority;`
| 265 | `88` |  | `Scenario = scenario;`
| 265 | `89` |  | `ExecutionConditionState = executionConditionState;`
| 265 | `90` |  | `NextState = nextState;`
| 265 | `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)`
| 51 | `99` |  | `{`
| 51 | `100` |  | `return await Provider.ProvideResponseAsync(requestMessage);`
| 51 | `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] string nextState)`
| 295 | `110` |  | `{`
| 295 | `111` |  | `var result = new RequestMatchResult();`
|  | `112` |  | ``
| 295 | `113` |  | `RequestMatcher.GetMatchingScore(requestMessage, result);`
|  | `114` |  | ``
|  | `115` |  | `// Only check state if Scenario is defined`
| 295 | `116` |  | `if (Scenario != null)`
| 30 | `117` |  | `{`
| 30 | `118` |  | `var matcher = new RequestMessageScenarioAndStateMatcher(nextState, ExecutionConditionState);`
| 30 | `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` |  | `//}`
| 30 | `127` |  | `}`
|  | `128` |  | ``
| 295 | `129` |  | `return result;`
| 295 | `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>`
| 166 | `138` |  | `public bool IsAdminInterface => Provider is DynamicResponseProvider || Provider is DynamicAsyncResponseProvider`
|  | `139` |  | `}`
|  | `140` |  | `}`

# Methods/Properties

Guid()
Title()
Path()
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.String,System.String)
ResponseToAsync()
GetRequestMatchResult(WireMock.RequestMessage,System.String)
IsAdminInterface()