I am working with TypeMock 5.3.1. If I create a group of classes like this:
public class A<T>
{
virtual public int GetOne()
{
return 1;
}
}
public class B<T> : A<T>
{
public override int GetOne()
{
return GetTwo();
}
private int GetTwo()
{
return 2;
}
}
public class C : B<int>
{
}
And run the code in a test like this:
[TestMethod]
public void TestMethod()
{
C c = new C();
Isolate.NonPublic.WhenCalled(c, "GetTwo").DoInstead(callContext =>
{
return 20;
});
Assert.AreEqual(20, c.GetOne());
}
I get a NullReferenceException. Is this a bug, or am I doing something wrong?
The example is nonsense, but it mimics facets of some real code that I'm attempting to test. Any help that you can offer would be appreciated.
Thanks!