mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-25 10:19:04 +02:00
Add Scenario set State method (#1322)
* Add SetScenarioState * add tests * summary * . * 1.8.13-preview-01 * fix * fix name
This commit is contained in:
@@ -567,6 +567,32 @@ public partial class WireMockServer : IWireMockServer
|
||||
return _options.Scenarios.ContainsKey(name) && _options.Scenarios.TryRemove(name, out _);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[PublicAPI]
|
||||
public bool SetScenarioState(string name, string? state)
|
||||
{
|
||||
if (state == null)
|
||||
{
|
||||
return ResetScenario(name);
|
||||
}
|
||||
|
||||
_options.Scenarios.AddOrUpdate(
|
||||
name,
|
||||
_ => new ScenarioState
|
||||
{
|
||||
Name = name,
|
||||
NextState = state
|
||||
},
|
||||
(_, current) =>
|
||||
{
|
||||
current.NextState = state;
|
||||
return current;
|
||||
}
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IWireMockServer.WithMapping(MappingModel[])" />
|
||||
[PublicAPI]
|
||||
public IWireMockServer WithMapping(params MappingModel[] mappings)
|
||||
|
||||
Reference in New Issue
Block a user