Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds stateful behavior similar to wiremock.
By default there are no changes in semantic. All previous code will work without any changes.
There are 2 methods added in
IRespondWithAProvider
interface:IRespondWithAProvider WhenStateIs(object state);
- defined mapping will be processed only in case the current state is equals to specified.IRespondWithAProvider WillSetStateTo(object state);
- In case the concrete mapping was selected and executed with the success, the current state will be changed to the specified.All states are per server. The default state is
null
so for the entry request it is not required to specifyWhenStateIs
.Both methods can be used together or separately.
Dynamic typing is used over generics, so state is of
object
type.Usage example:
Once this mapping is executed, the state will be changed to
Test state
, so it will not be executed the next time.Test state
.