mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 21:10:32 +01:00
Stay in Current State for specified number of requests #288
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @shoaibshakeel381 on GitHub (Jul 30, 2020).
Hey guy,s I need to write mocks such that a request keeps faulting for a given number of time before it can succeed. I know that I can use Scenarios for this.
But there's a problem. Let's suppose I want to fault my request 2 times before succeeding on 3rd attempt. So I have to write three mocks where flow would be like this:
We can see that first 2 states are just doing same thing. So my question is this: Is it possible to build a mock which stay in its current state for a given number of time, before switching to next one. So my mocks would be like below:
@StefH commented on GitHub (Jul 30, 2020):
@shoaibshakeel381
Probably the interface can look like:
or
@shoaibshakeel381 commented on GitHub (Jul 30, 2020):
@StefH I would suggest second approach. Here's why:
WillSetStateTo()so it would make sense to keep both values in one atomic operationWhenMatchingCountEquals()can be misplaced like this:which is not very readable. It can even be used like this:
which doesn't make sense.
@StefH commented on GitHub (Aug 1, 2020):
@shoaibshakeel381
Can you try preview version
WireMock.Net.1.2.16-ci-13650.nupkgfrom MyGet ? (https://github.com/WireMock-Net/WireMock.Net/wiki/MyGet-preview-versions)@shoaibshakeel381 commented on GitHub (Aug 1, 2020):
I tested this preview version on my tests and it worked flawlessly. Great job.
@StefH commented on GitHub (Aug 1, 2020):
I'll create an official version within some time.
https://github.com/WireMock-Net/WireMock.Net/pull/495