Members.ReturnRecursiveFakes are not faking private members.
Here's my production code:
public class AnObject
{
public void DoNothing()
{
}
}
public class AnWrapperObject
{
private AnObject objAn;
public void CallDoNothing()
{
objAn.DoNothing();
}
}
here's my test code
[TestFixture]
public class TestClass
{
public void Test1()
{
AnWrapperObject wrappObj = Isolate.Fake.Instance<AnWrapperObject>(Members.ReturnRecursiveFakes);
Isolate.WhenCalled(() => wrappObj.CallDoNothing()).CallOriginal();
wrappObj.CallDoNothing();
}
}
And here's the exception:
TestCase 'TestClass.Test1' failed: Object reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
If I changed the line
private AnObject objAn;
to
public AnObject objAn
{
get;
private set;
}
then there is no such problem.
________
medical marijuana