I am trying to stub a method call of a class like this:
Manager managerStub = MockRepository.GenerateStub(constructordata);
managerStub.Stub(x => x.GetData(Arg.Is.Anything)).Return(10)
But when I try to run this unit test, Rhino mocks calls the "GetData" method, with parameter "0" on the "manager.Stub..." line.
Why does Rhino Mocks call the real method?
If you request a stub of a class RhinoMocks creates a derived class on the fly and overrides the methods you want to stub.
However, if the method you want to stub is not virtual
RhinoMocks can't override it and thus it can't stub it.
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