I have code:
Foo mock = Isolate.Fake.Instance<Foo>();
Isolate.Swap.NextInstance<Foo>().With(mock);
Isolate.WhenCalled(() => mock.Method(null)).WillReturn(fakeResults);
Problem is the method I'm testing internal creates an instance of Fool and calls the method that we have 'WhenCalledFor', disposes Foo, does some heavy lifting, then creates an instance of Foo again to call a different method.
Problem is that the 2nd instance of Foo created is creating a 'real' Foo, which I don't want, ideally I want:
Foo mock = Isolate.Fake.Instance<Foo>();
Isolate.Swap.AllFutureInstances<Foo>().With(mock);
Isolate.WhenCalled(() => mock.Method(null)).WillReturn(fakeResults);
Isolate.WhenCalled(() => mock.SomeOtherMethod(null)).WillReturn(otherFakeResults);
Would the record/replay syntax be better for this?