There seems to be some strange behavior when setting up expectations with mocked objects that return recursive fakes:
TestObject a = Isolate.Fake.Instace<TestObject>(Members.ReturnRecursiveFakes);
Isolate.WhenCalled(() => a.DoSomething(a.SomeProperty.SomeOtherProperty)).WithExactArguments().WillReturn(someValue);
Returns the following exception:
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
The only workaround currently is to do the following:
TestObject a = Isolate.Fake.Instace<TestObject>(Members.ReturnRecursiveFakes);
var parameter = a.SomeProperty.SomeOtherProperty;
Isolate.WhenCalled(() => a.DoSomething(parameter)).WithExactArguments().WillReturn(someValue);
I can understand if this is a limitation of the Isolator, but would request if it's possible to have this added as a future feature since the current workaround requires creating a lot of useless variables when setting up a lot of expectations.