views:

95

answers:

1

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);
+3  A: 

There sure is:

Expect.Call(mockObject.Method(null)).IgnoreArguments().Return(alwaysReturn)
womp
Thanks. Don't know how I missed it. I guess there's a bunch of stuff to learn here :)
benjynito
Rhino is a really flexible framework, but the learning curve is steep. If you're dealing with .Net 3.5, I would highly recommend Moq over Rhino.
womp