Returning Different Results for Sequential Calls
Multiple return values
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 returning from a function, but passing multiple values to Returns()
is simpler and reads better.
Multiple returns using callbacks
Returns()
also supports passing multiple functions to return from, which allows one call in a sequence to throw an exception or perform some other action.
Configuring other calls without using up multiple returns
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 .Configure()
.
Last updated