Returning Different Results for Sequential Calls
Last updated
Last updated
A call can also be configured to return a different value over multiple calls. The following example shows this for a call to a property, but it works the same way for method calls.
This can also be achieved by , but passing multiple values to Returns()
is simpler and reads better.
Returns()
also supports passing multiple , which allows one call in a sequence to throw an exception or perform some other action.
If a call has been configured with multiple returns values, you can configure a more specific call without using up any of these callbacks using .