mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-09 18:33:33 +02:00
stateful behavior + tests
This commit is contained in:
@@ -12,6 +12,9 @@ namespace WireMock.Server
|
||||
private Guid? _guid;
|
||||
private string _title;
|
||||
|
||||
private object _executionConditionState = null;
|
||||
private object _nextState = null;
|
||||
|
||||
/// <summary>
|
||||
/// The _registration callback.
|
||||
/// </summary>
|
||||
@@ -42,7 +45,19 @@ namespace WireMock.Server
|
||||
public void RespondWith(IResponseProvider provider)
|
||||
{
|
||||
var mappingGuid = _guid ?? Guid.NewGuid();
|
||||
_registrationCallback(new Mapping(mappingGuid, _title, _requestMatcher, provider, _priority));
|
||||
_registrationCallback(new Mapping(mappingGuid, _title, _requestMatcher, provider, _priority, _executionConditionState, _nextState));
|
||||
}
|
||||
|
||||
public IRespondWithAProvider WhenStateIs(object state)
|
||||
{
|
||||
_executionConditionState = state;
|
||||
return this;
|
||||
}
|
||||
|
||||
public IRespondWithAProvider WillSetStateTo(object state)
|
||||
{
|
||||
_nextState = state;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user