Question

In NMocks2 you can mock up the result of a method you don't know the arguments to before hand using

Stub.On(aMock)
    .Method( ... )
    .WithAnyArguments()
    .Will(Return.Value( ... );

from NMocks2 Cheatsheet. My question is, is there a similar mechanism for Rhino mocks when you don't care about the arguments? I want to make a call similar to:

    object objectIDontWantToRecreate = null; // Won't be null in actuality
    object alwaysReturned = ...;
    Expect.Call(mockObject.Method(objectIDontWantToRecreate)).Return(alwaysReturned);
Was it helpful?

Solution

There sure is:

Expect.Call(mockObject.Method(null)).IgnoreArguments().Return(alwaysReturn)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top