What if I have several calls to a method that all happen without a chance
for me to reset the stub? e.g.
stub.Stub(o => o.SomeMethod()).Return("1");
stub.Stub(o => o.SomeMethod()).Return("2");
sut.SomeAction(stub);I think that always returns 2, but what I want is for the first call to SomeMethod to return 1, and then on the second call for it to return 2. This all happens inside my sut's SomeAction() method. Repeat.Once() doesn't seem to change this behavior. What's the best way to handle this kind of scenario? WhenCalled and keep a counter? I thought there was a smarter way to do this. On Wed, Jul 29, 2009 at 8:13 PM, Kenneth Xu <[email protected]> wrote: > > On Wed, Jul 29, 2009 at 6:09 PM, Kenneth Xu<[email protected]> wrote: > > Try to use Callback instead of return > > Sorry, it should be "Do" that I used for this. I always confused it > with "Callback", which is for parameter checking. > > Thanks for the WhenCalled. It is even better in this case. > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Rhino.Mocks" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/RhinoMocks?hl=en -~----------~----~----~----~------~----~------~--~---
