I am (very successfully!) using Isolator for TDD of a SharePoint library, but have found a mocking behaviour that doesn't quite act as expected.
The code under test uses the following statement to get the value from a field in the list item:
listItem[fieldName].ToString()
When mocking an SPListItem, I am trying to set the values returned by fields in this list item using that above statement. In my test I have the following:
SPListItem fakeListItem = Isolate.Fake.Instance<SPListItem>();
Isolate.WhenCalled(() => fakeListItem["Data"].ToString()).WillReturn("SomeData");
Isolate.WhenCalled(() => fakeListItem["Description"].ToString()).WillReturn("SomeDescription");
However, when I call the "listItem[fieldName].ToString()" method with fieldName set to "Data", I get the value "SomeDescription" returned during my tests. If I swap the order of those two Isolate.WhenCalled lines, then both fieldNames return "SomeData"
Does that mean that Isolator does not fake the list item to the level of the explicitly named fields?