Given the following code:
class ClassWithDictionary
{
public Dictionary<string> TheDictionary { get; private set; }
public ClassWithDictionary()
{
TheDictionary = new Dictionary<string>();
}
}
class ClassUnderTest
{
public bool DoSomething( ClassWithDictionary param )
{
return param.TheDictionary.ContainsKey("toto");
}
}
and the following test:
[TestMethod]
[Isolated]
public void TestRecursiveFakeOnDictionary()
{
ClassWithDictionary fake = Isolate.Fake.Instance<ClassWithDictionary>(Members.ReturnRecursiveFakes);
ClassUnderTest target = new ClassUnderTest();
target.DoSomething(fake);
}
I expected the test to pass but getting the TheDictionary property in DoSomething() returns null which results in a NullReferenceException.
Is there something I missed which would explain why a recursive fake is not returned when TheDictionary is called?
I am using version 6.0.