Not sure on where the 'problem' is, so maybe it's in Isolator, maybe somewhere else.
Using Microsoft Patterns & Practices Enterprise Library (version 3.1); Caching Application block specifically.
I have the following set up in my test:
//fake caching mechanism
CacheManager cacheManagerFake = Isolate.Fake.Instance<CacheManager>();
Isolate.WhenCalled(() => CacheFactory.GetCacheManager()).WillReturn(cacheManagerFake);
Isolate.WhenCalled(() => cacheManagerFake.Contains("")).WillReturn(true);
Isolate.WhenCalled(() => cacheManagerFake[""]).WillReturn(mock);
The last line is the source of the problem. When I run test, it's returning null (default of the fake), if I change my call to cacheManagerFake.GetData("") as shown below I get expected results.
//fake caching mechanism
CacheManager cacheManagerFake = Isolate.Fake.Instance<CacheManager>();
Isolate.WhenCalled(() => CacheFactory.GetCacheManager()).WillReturn(cacheManagerFake);
Isolate.WhenCalled(() => cacheManagerFake.Contains("")).WillReturn(true);
Isolate.WhenCalled(() => cacheManagerFake.GetData("")).WillReturn(mock);
I'm not sure if this is possibile issue with default property indexers or something else but thankfully the work around was easy. Is there a know issue here though? (I'm on 5.2.2)