Hi,
Thanks for any help you can give me, I'm probably missing something simple here, but I'm trying to do the following:
public class BaseClass
{
public int SomeMethod()
{
return 1;
}
}
public class DerivedClass : BaseClass
{
public int SomeMethodNew()
{
return base.SomeMethod() + 1;
}
}
[TestMethod]
public void Test()
{
Mock<DerivedClass> mock = MockManager.Mock<DerivedClass>();
// mock only BaseClass.SomeMethod when called from a DerivedClass Type.
mock.CallBase.ExpectAndReturn("SomeMethod", 100);
DerivedClass d = new DerivedClass();
int result = d.SomeMethodNew();
Assert.AreEqual(101, result);
}
I've modified the sample for the CallBase documentation to call a different method name rather than an overriden method.
This doesn't work though, so how do i mock out the call to the base class? I've tried mocking the base class directly but this doesn't seem to work either.
[TestMethod]
public void Test()
{
Mock<BaseClass> mock = MockManager.Mock<BaseClass>();
mock.ExpectAndReturn("SomeMethod", 100);
DerivedClass d = new DerivedClass();
int result = d.SomeMethodNew();
Assert.AreEqual(101, result);
}
Any Ideas??
Cheers,
Rob
________
Super Cub