public class ClassSim { public void DoNothing() { } public ClassSim() { } } public class ClassComp { public ClassSim sim=new ClassSim(); public ClassComp() { sim=new ClassSim(); } public void CallClassSim() { //sim = new ClassSim(); sim.DoNothing(); } }
[Test] [Isolated] public void TestNest() { ClassComp compFake = Isolate.Fake.Instance<ClassComp>(Members.CallOriginal); ClassSim simFake = Isolate.Fake.Instance<ClassSim>(); Isolate.WhenCalled(()=>compFake.sim).WillReturn(simFake); }
Hi Soon, No, mocking fields is not planned for this release. But why not just set the field? You don't need faking to do this. Thanks,