NMocks2 Argument Syntax in Rhino Mocks?
-
05-07-2019 - |
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);
Solution
There sure is:
Expect.Call(mockObject.Method(null)).IgnoreArguments().Return(alwaysReturn)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow