Adding flexibility to return values using Stub methods.
Continuing on my “Testing with Dummy objects” article, you might have noticed a limitation with regards to the return value – only one was allowed.
In situations where multiple return values are needed, Stub methods provide an alternative.
In my previous example, GetSalesOutcome() only provided one return value.
However, if I need my test method to return multiple values for more flexible testing, I may rewrite my test method to accommodate that need.
As you can see, the test still passes, but now I am able to use a much more flexible test, in this case testing for multiple sales associates.