Summary

Class:WireMock.Matchers.Request.RequestMessageScenarioAndStateMatcher
Assembly:WireMock.Net
File(s):C:\Users\azureuser\Documents\Github\WireMock.Net\src\WireMock.Net\Matchers\Request\RequestMessageScenarioAndStateMatcher.cs
Covered lines:12
Uncovered lines:0
Coverable lines:12
Total lines:51
Line coverage:100%
Branch coverage:100%

Metrics

MethodCyclomatic complexity  NPath complexity  Sequence coverage  Branch coverage  
.ctor(...)10100100
GetMatchingScore(...)10100100
IsMatch()32100100

File(s)

C:\Users\azureuser\Documents\Github\WireMock.Net\src\WireMock.Net\Matchers\Request\RequestMessageScenarioAndStateMatcher.cs

#LineLine coverage
 1using JetBrains.Annotations;
 2
 3namespace WireMock.Matchers.Request
 4{
 5    /// <summary>
 6    /// The scenario and state matcher.
 7    /// </summary>
 8    internal class RequestMessageScenarioAndStateMatcher : IRequestMatcher
 9    {
 10        ///// <summary>
 11        ///// Scenario.
 12        ///// </summary>
 13        //[CanBeNull] private string _scenario;
 14
 15        /// <summary>
 16        /// Execution state condition for the current mapping.
 17        /// </summary>
 18        [CanBeNull]
 19        private readonly object _executionConditionState;
 20
 21        /// <summary>
 22        /// The next state which will be signaled after the current mapping execution.
 23        /// In case the value is null state will not be changed.
 24        /// </summary>
 25        [CanBeNull]
 26        private readonly object _nextState;
 27
 28        /// <summary>
 29        /// Initializes a new instance of the <see cref="RequestMessageScenarioAndStateMatcher"/> class.
 30        /// </summary>
 31        /// <param name="nextState">The next state.</param>
 32        /// <param name="executionConditionState">Execution state condition for the current mapping.</param>
 1433        public RequestMessageScenarioAndStateMatcher([CanBeNull] object nextState, [CanBeNull] object executionCondition
 1434        {
 1435            _nextState = nextState;
 1436            _executionConditionState = executionConditionState;
 1437        }
 38
 39        /// <inheritdoc />
 40        public double GetMatchingScore(RequestMessage requestMessage, RequestMatchResult requestMatchResult)
 1441        {
 1442            double score = IsMatch();
 1443            return requestMatchResult.AddScore(GetType(), score);
 1444        }
 45
 46        private double IsMatch()
 1447        {
 1448             return Equals(_executionConditionState, _nextState) ? MatchScores.Perfect : MatchScores.Mismatch;
 1449        }
 50    }
 51}