I want to create a stub of the following interface:
interface IUnitOfWork
{
void DoInTransaction(Action method);
}
In the stub object, all I want DoInTransaction
to do is run method()
.
Something like:
// pseudo-code
unitOfWorkStub.Stub(x => x.DoInTransaction(method)).Do(method())
Is it possible to create this kind of a stub with RhinoMocks? How can this be done?
use this:
unitOfWorkStub.Stub(x => x.DoInTransaction(Arg<Action>.Is.Anything))
.WhenCalled(x => ((Action)x.Arguments[0])());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With