Summary

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

Metrics

MethodCyclomatic complexity NPath complexity Sequence coverage Branch coverage
GetMatchingScore(...)0010
IsMatch()0011
.ctor(...)0010

File(s)

C:\Users\StefHeyenrath\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        /// Execution state condition for the current mapping.
 12        /// </summary>
 13        [CanBeNull]
 14        private readonly string _executionConditionState;
 15
 16        /// <summary>
 17        /// The next state which will be signaled after the current mapping execution.
 18        /// In case the value is null state will not be changed.
 19        /// </summary>
 20        [CanBeNull]
 21        private readonly string _nextState;
 22
 23        /// <summary>
 24        /// Initializes a new instance of the <see cref="RequestMessageScenarioAndStateMatcher"/> class.
 25        /// </summary>
 26        /// <param name="nextState">The next state.</param>
 27        /// <param name="executionConditionState">Execution state condition for the current mapping.</param>
 3028        public RequestMessageScenarioAndStateMatcher([CanBeNull] string nextState, [CanBeNull] string executionCondition
 3029        {
 3030            _nextState = nextState;
 3031            _executionConditionState = executionConditionState;
 3032        }
 33
 34        /// <inheritdoc />
 35        public double GetMatchingScore(RequestMessage requestMessage, RequestMatchResult requestMatchResult)
 3036        {
 3037            double score = IsMatch();
 3038            return requestMatchResult.AddScore(GetType(), score);
 3039        }
 40
 41        private double IsMatch()
 3042        {
 3043            return Equals(_executionConditionState, _nextState) ? MatchScores.Perfect : MatchScores.Mismatch;
 3044        }
 45    }
 46}