The following test code results in this error message: "Instance passed is a handle to a future fake, but no instance was created"
How do I fix this?
My real aim is to replace all future instances of the Singleton class with my own instance. Am I going about this the wrong way?
Class I am trying to fake:
public sealed class Singleton
{
....
private Dictionary<string, Agent> _dictAgent = new Dictionary<string, Agent>();
....
}
My test code (abbreviated):
[TestMethod, Isolated]
public void CheckpointTest4()
{
var fakeCoordinator = Isolate.Fake.AllInstances<Coordinator>(Members.CallOriginal);
Isolate.NonPublic.InstanceField(fakeCoordinator, "_dictAgent").Value = new Dictionary<string, Agent>
{
{"11", new Agent() }
};
}