More thoughts on Typemock Isolator, Microsoft Fakes and Sharepoint
I posted yesterday on using Typemock and Microsoft Fakes with SharePoint. After a bit more thought I realised the key thing in using Typemock I found easier was the construction of my SPListItem dataset. Typemock allowed me to fake SPListItems and put them in a generic List<SPListItem> then just make this the return value for the Item collection using the magic .WillReturnCollectionValuesOf() method that converts my List to the required collection type. With the Microsoft Fakes I had think about a delegate that constructed my test data at runtime. This is not a problem, just a different way of working.
A side effect of using the Typemock .WillReturnCollectionValuesOf() method is that if I check the number of SPListItems in the return SPListColection I have a real collection so I can use the collection’s own .Count method, I don’t have fake it out. With the Microsoft Fakes as there is no collection returned so I must Fake its return value.
This is a trend common across Typemock Isolator, it does much of the work for you. Microsoft Fakes, like Moles, required you to do the work. In Moles this was addressed by the use of behaviour packs to get you started with standard items you need in SharePoint.
I would say again that there may be other ways of using the Microsoft Fakes library, so there maybe ways to address these initial comments of mine, I am keen to see if this is the case
Read the complete post at http://blogs.blackmarble.co.uk/blogs/rfennell/post/2012/03/24/More-thoughts-on-Typemock-Isolator-Microsoft-Fakes-and-Sharepoint.aspx