# Summary

Class: | WireMock.Server.RespondWithAProvider
Assembly: | WireMock.Net
File(s): | C:\Users\azureuser\Documents\Github\WireMock.Net\src\WireMock.Net\Server\RespondWithAProvider.cs
Covered lines: | 42
Uncovered lines: | 4
Coverable lines: | 46
Total lines: | 115
Line coverage: | 91.3%
Branch coverage: | 50%

# Metrics

Method | Cyclomatic complexity | NPath complexity | Sequence coverage | Branch coverage
--- | --- | --- | --- | ---
RespondWith(...) | 0 | 0 | 1 | 0
WithGuid(...) | 0 | 0 | 1 | 0
WithGuid(...) | 0 | 0 | 1 | 0
WithTitle(...) | 0 | 0 | 1 | 0
WithPath(...) | 0 | 0 | 1 | 0
AtPriority(...) | 0 | 0 | 1 | 0
InScenario(...) | 0 | 0 | 1 | 0
WhenStateIs(...) | 0 | 0 | 0.714 | 0.5
WillSetStateTo(...) | 0 | 0 | 0.714 | 0.5
.ctor(...) | 0 | 0 | 1 | 0

# File(s)

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

| # | Line |  | Line coverage
--- | --- | --- | --- | ---
|  | `1` |  | `using System;`
|  | `2` |  | `using WireMock.Matchers.Request;`
|  | `3` |  | `using WireMock.ResponseProviders;`
|  | `4` |  | ``
|  | `5` |  | `namespace WireMock.Server`
|  | `6` |  | `{`
|  | `7` |  | `/// <summary>`
|  | `8` |  | `/// The respond with a provider.`
|  | `9` |  | `/// </summary>`
|  | `10` |  | `internal class RespondWithAProvider : IRespondWithAProvider`
|  | `11` |  | `{`
|  | `12` |  | `private int _priority;`
|  | `13` |  | `private string _title;`
|  | `14` |  | `private string _path;`
|  | `15` |  | `private string _executionConditionState;`
|  | `16` |  | `private string _nextState;`
|  | `17` |  | `private string _scenario;`
|  | `18` |  | `private readonly RegistrationCallback _registrationCallback;`
|  | `19` |  | `private readonly IRequestMatcher _requestMatcher;`
|  | `20` |  | ``
| 553 | `21` |  | `public Guid Guid { get; private set; } = Guid.NewGuid();`
|  | `22` |  | ``
|  | `23` |  | `/// <summary>`
|  | `24` |  | `/// Initializes a new instance of the <see cref="RespondWithAProvider"/> class.`
|  | `25` |  | `/// </summary>`
|  | `26` |  | `/// <param name="registrationCallback">The registration callback.</param>`
|  | `27` |  | `/// <param name="requestMatcher">The request matcher.</param>`
| 264 | `28` |  | `public RespondWithAProvider(RegistrationCallback registrationCallback, IRequestMatcher requestMatcher)`
| 264 | `29` |  | `{`
| 264 | `30` |  | `_registrationCallback = registrationCallback;`
| 264 | `31` |  | `_requestMatcher = requestMatcher;`
| 264 | `32` |  | `}`
|  | `33` |  | ``
|  | `34` |  | `/// <summary>`
|  | `35` |  | `/// The respond with.`
|  | `36` |  | `/// </summary>`
|  | `37` |  | `/// <param name="provider">The provider.</param>`
|  | `38` |  | `public void RespondWith(IResponseProvider provider)`
| 264 | `39` |  | `{`
| 264 | `40` |  | `_registrationCallback(new Mapping(Guid, _title, _path, _requestMatcher, provider, _priority, _scenario, _exe`
| 264 | `41` |  | `}`
|  | `42` |  | ``
|  | `43` |  | `/// <see cref="IRespondWithAProvider.WithGuid(string)"/>`
|  | `44` |  | `public IRespondWithAProvider WithGuid(string guid)`
| 2 | `45` |  | `{`
| 2 | `46` |  | `return WithGuid(Guid.Parse(guid));`
| 2 | `47` |  | `}`
|  | `48` |  | ``
|  | `49` |  | `/// <see cref="IRespondWithAProvider.WithGuid(Guid)"/>`
|  | `50` |  | `public IRespondWithAProvider WithGuid(Guid guid)`
| 14 | `51` |  | `{`
| 14 | `52` |  | `Guid = guid;`
|  | `53` |  | ``
| 14 | `54` |  | `return this;`
| 14 | `55` |  | `}`
|  | `56` |  | ``
|  | `57` |  | `/// <see cref="IRespondWithAProvider.WithTitle"/>`
|  | `58` |  | `public IRespondWithAProvider WithTitle(string title)`
| 4 | `59` |  | `{`
| 4 | `60` |  | `_title = title;`
|  | `61` |  | ``
| 4 | `62` |  | `return this;`
| 4 | `63` |  | `}`
|  | `64` |  | ``
|  | `65` |  | `/// <see cref="IRespondWithAProvider.WithPath"/>`
|  | `66` |  | `public IRespondWithAProvider WithPath(string path)`
| 10 | `67` |  | `{`
| 10 | `68` |  | `_path = path;`
|  | `69` |  | ``
| 10 | `70` |  | `return this;`
| 10 | `71` |  | `}`
|  | `72` |  | ``
|  | `73` |  | `/// <see cref="IRespondWithAProvider.AtPriority"/>`
|  | `74` |  | `public IRespondWithAProvider AtPriority(int priority)`
| 222 | `75` |  | `{`
| 222 | `76` |  | `_priority = priority;`
|  | `77` |  | ``
| 222 | `78` |  | `return this;`
| 222 | `79` |  | `}`
|  | `80` |  | ``
|  | `81` |  | `/// <see cref="IRespondWithAProvider.InScenario(string)"/>`
|  | `82` |  | `public IRespondWithAProvider InScenario(string scenario)`
| 10 | `83` |  | `{`
| 10 | `84` |  | `_scenario = scenario;`
|  | `85` |  | ``
| 10 | `86` |  | `return this;`
| 10 | `87` |  | `}`
|  | `88` |  | ``
|  | `89` |  | `/// <see cref="IRespondWithAProvider.WhenStateIs"/>`
|  | `90` |  | `public IRespondWithAProvider WhenStateIs(string state)`
| 6 | `91` |  | `{`
| 6 | `92` |  | `if (string.IsNullOrEmpty(_scenario))`
| 0 | `93` |  | `{`
| 0 | `94` |  | `throw new NotSupportedException("Unable to set state condition when no scenario is defined.");`
|  | `95` |  | `}`
|  | `96` |  | ``
| 6 | `97` |  | `_executionConditionState = state;`
|  | `98` |  | ``
| 6 | `99` |  | `return this;`
| 6 | `100` |  | `}`
|  | `101` |  | ``
|  | `102` |  | `/// <see cref="IRespondWithAProvider.WillSetStateTo"/>`
|  | `103` |  | `public IRespondWithAProvider WillSetStateTo(string state)`
| 5 | `104` |  | `{`
| 5 | `105` |  | `if (string.IsNullOrEmpty(_scenario))`
| 0 | `106` |  | `{`
| 0 | `107` |  | `throw new NotSupportedException("Unable to set next state when no scenario is defined.");`
|  | `108` |  | `}`
|  | `109` |  | ``
| 5 | `110` |  | `_nextState = state;`
|  | `111` |  | ``
| 5 | `112` |  | `return this;`
| 5 | `113` |  | `}`
|  | `114` |  | `}`
|  | `115` |  | `}`

# Methods/Properties

Guid()
.ctor(WireMock.RegistrationCallback,WireMock.Matchers.Request.IRequestMatcher)
RespondWith(WireMock.ResponseProviders.IResponseProvider)
WithGuid(System.String)
WithGuid(System.Guid)
WithTitle(System.String)
WithPath(System.String)
AtPriority(System.Int32)
InScenario(System.String)
WhenStateIs(System.String)
WillSetStateTo(System.String)