I have a class, something like this
public class MyClass
{
public virtual string MethodA(Command cmd)
{
public void MethodB(SomeType obj)
{
MethodA(command);
}
}
I made fun of MyClass as PartialMock ( mocks.PartialMock<MyClass>) and I am setting the wait for MethodA
var cmd = new Command();
Expect.Call(MyClass.MethodA(cmd)).Repeat.Once();
The problem is that MethodB invokes the actual implementation of MethodA instead of mocking it. I have to do something wrong (not very experienced with RhinoMocks). How to make him make fun of MetdhodA?
Here is the actual code:
var cmd = new SetBaseProductCoInsuranceCommand();
cmd.BaseProduct = planBaseProduct;
var insuredType = mocks.DynamicMock<InsuredType>();
Expect.Call(insuredType.Code).Return(InsuredTypeCode.AllInsureds);
cmd.Values.Add(new SetBaseProductCoInsuranceCommand.CoInsuranceValues()
{
CoInsurancePercent = 0,
InsuredType = insuredType,
PolicySupplierType = ppProvider
});
Expect.Call(() => service.SetCoInsurancePercentages(cmd)).Repeat.Once();
mocks.ReplayAll();
service.DefaultCoInsurancesFor(planBaseProduct);
service.AssertWasCalled(x => x.SetCoInsurancePercentages(cmd),x=>x.Repeat.Once());
source
share