This sounds pretty similar to a discussion on a previous thread.
How do you specify ordered returns vs changing the return value...
http://groups.google.com/group/rhinomocks/browse_thread/thread/bd07141e99ab8871/7ffee484f51f2646#7ffee484f51f2646

On Jan 29, 7:30 pm, bill richards <[email protected]>
wrote:
> Let me try to understand what it is that you want ...
>
> you want the mocking framework to ignore all arguments, and you want
> one object to be returned in the first call and another object to be
> returned in the second call?
>
> I have pasted your code into my IDE and used Rhino v. 3.5.0.1337: It
> fails, so the behaviour between the two versions is actuallly
> consistent.
>
> Changing your test as follows makes the test pass ...
>
>             var mockFactory = MockRepository.GenerateMock<IFactory>();
>             var returnValue1 = new object();
>             var returnValue2 = new object();
>             mockFactory.Expect(f => f.Create(1)).Return(returnValue1);
>             mockFactory.Expect(f => f.Create(2)).Return(returnValue2);
>             var actualReturnValue1 = mockFactory.Create(1);
>             var actualReturnValue2 = mockFactory.Create(2);
>             Assert.AreEqual(returnValue1, actualReturnValue1,
> "returnValue1 and actualReturnValue1 are different");
>             Assert.AreEqual(returnValue2    , actualReturnValue2,
> "returnValue2 and actualReturnValue2 are different");
>
> or the following change makes the test pass:
>
>             var mockFactory = MockRepository.GenerateMock<IFactory>();
>             var returnValue1 = new object();
>             var returnValue2 = new object();
>             mockFactory.Expect(f => f.Create(0)).IgnoreArguments
> ().Return(returnValue1);
>             mockFactory.Expect(f => f.Create(0)).IgnoreArguments
> ().Return(returnValue2);
>             var actualReturnValue1 = mockFactory.Create(1);
>             var actualReturnValue2 = mockFactory.Create(2);
>             Assert.AreEqual(returnValue1, actualReturnValue1,
> "returnValue1 and actualReturnValue1 are different");
>             Assert.AreEqual(returnValue1, actualReturnValue2,
> "returnValue1 and actualReturnValue2 are different");
>
> Now let us imagine why this is the case ....
>
>            .IgnoreArguments().Return(returnValue1)
>
> You have told the mocking framework to IGNORE ALL ARGUMENTS and RETURN
> returnValue1
>
> why would you tell the mocking framework to ignore all arguments if
> you want two different return values? Surely everyone needs some way
> to determine when to return one value over another?

-- 
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.

Reply via email to