mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-20 15:31:20 +02:00
Scenario : stay on current state for a number of times (#495)
* state * xml comment
This commit is contained in:
@@ -23,12 +23,12 @@ namespace WireMock.Owin
|
||||
{
|
||||
try
|
||||
{
|
||||
string scenario = mapping.Scenario != null && _options.Scenarios.ContainsKey(mapping.Scenario) ? _options.Scenarios[mapping.Scenario].NextState : null;
|
||||
string nextState = GetNextState(mapping);
|
||||
|
||||
mappings.Add(new MappingMatcherResult
|
||||
{
|
||||
Mapping = mapping,
|
||||
RequestMatchResult = mapping.GetRequestMatchResult(request, scenario)
|
||||
RequestMatchResult = mapping.GetRequestMatchResult(request, nextState)
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -56,5 +56,18 @@ namespace WireMock.Owin
|
||||
|
||||
return (match, partialMatch);
|
||||
}
|
||||
|
||||
private string GetNextState(IMapping mapping)
|
||||
{
|
||||
// If the mapping does not have a scenario or _options.Scenarios does not contain this scenario from the mapping,
|
||||
// just return null to indicate that there is no next state.
|
||||
if (mapping.Scenario == null || !_options.Scenarios.ContainsKey(mapping.Scenario))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Else just return the next state
|
||||
return _options.Scenarios[mapping.Scenario].NextState;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user