Peli provides a good overview on how you can use Pex Moles to unit test SharePoint applications by mocking away the SharePoint API calls.

http://research.microsoft.com/en-us/projects/pex/pexsharepoint.pdf