Thanks for your reply.
I don't understand how the modified test helps? It seems to be verifying that certain methods have been called? I don't want to test that, though, I want to test if my method has added an item to a list.
For example, if I am the writer of SimpleWebPart, and I am the writer of it's unit test, and suppose I don't know that you have to call item.Update() in order to commit changes, I'm going to write my method with:
SPListItem item = Web.Lists["TestList"].Items.Add();
item["Title"] = "testtitle";
and I'm going to write my test code with:
Isolate.Verify.WasCalledWithExactArguments(() => { fakeItem["Title"] = "testtitle"; });
so the unit test will pass, but my code won't actually update the list with the new item, because I'm only testing that method calls have taken place, not what their behavioural effect is.
I'm pretty new to Mocking in general, although I've been aware of Mocks and I've been using unit tests for quite a while, so it's very possible I'm missing the point here!
Any help greatly appreciated here.
Phil.