Unit Testing SharePoint Applications the easy way

“Typemock Isolator is a great way to open up the world of unit testing to
SharePoint developers. Unit testing SharePoint applications is an
important part of our soon to be released P&P SharePoint Guidance
and Typemock Isolator is integral to our unit testing guidance.”
Ajoy Krishnamoorthy, Lead Product Planner for Patterns & Practices, Developer Division at Microsoft

How to unit test your SharePoint custom code by isolating the object model (SPSite)

The biggest problem with testing SharePoint code is its dependency on the SharePoint object model. The following example shows how to easily unit test your custom code. Here’s the method we want to test:

Here’s how the test looks like:

Learn more:

Articles how others are using Isolator to test SharePoint Code: