// Copyright © WireMock.Net namespace WireMock.Matchers.Request; /// /// The scenario and state matcher. /// internal class RequestMessageScenarioAndStateMatcher : IRequestMatcher { /// /// Execution state condition for the current mapping. /// private readonly string? _executionConditionState; /// /// The next state which will be signaled after the current mapping execution. /// In case the value is null state will not be changed. /// private readonly string? _nextState; /// /// Initializes a new instance of the class. /// /// The next state. /// Execution state condition for the current mapping. public RequestMessageScenarioAndStateMatcher(string? nextState, string? executionConditionState) { _nextState = nextState; _executionConditionState = executionConditionState; } /// public double GetMatchingScore(IRequestMessage requestMessage, IRequestMatchResult requestMatchResult) { return requestMatchResult.AddScore(GetType(), GetScore(), null); } private double GetScore() { return Equals(_executionConditionState, _nextState) ? MatchScores.Perfect : MatchScores.Mismatch; } }