Can I set up a mock object to always return the object given as a parameter? I have a method
public MyObject DoSomething(MyObject obj)
and I want to have a mock which always returns obj for every call to DoSomething, sort of like this:
mock.Stub(x=>x.DoSomething(Arg<MyObject>.Is.Anything).Return(Arg<MyObject>)
although I'm not sure of what to put in the return bit...
EDIT: I tried this:
MyObject o=null;
mock.Stub(x=>x.DoSomething(Arg<MyObject>.Is.Anything).WhenCalled (y=>
{
o = y.Arguments[0] as MyObject;
}).Return (o);
which seemed like it might be promising but no luck. Posting it in case it jogs someone's memory...