My team is still working on the challenges of unit testing SharePoint code, and we're making good progress. The direction we've decided to go in is to perform all unit tests on the SharePoint server, wherever that may be. Testing with mock objects or through remote calls resulted in a lot of pain and difficulty.
So, we've noted a few things that we'd like to accomplish to make the deployment and execution of app/test code on a remote SharePoint server as simple as possible. Our ultimate goal is to create a (web) service that resides on the server that will allow you to upload any required files for performing a test (your test and app dll's, configs, etc), execute NUnit against the specified test assembly, and return NUnit's Xml results. For cases when you need to debug your test code, the developer will need to deploy their code by hand (e.g. using a batch file), log on to the server, and use the .Net SDK GUI-Debug to debug their code.
Last night I took a shot at implementing the web service, and it ended up working out very well. The service accepts the files as strings converted from byte arrays, saves the files locally in a temp directory on the server, executes NUnit against them, then returns the result from the console output of NUnit. You can include an XSLT stylesheet to format how you want your results to look too. Very, very simple, although I'm not posting any code yet because I'm not 100% happy with it yet :)
Ideally we'd like to write a VS.Net add-in so that you can do this all within the development environment instead of using some other client app for the service. Personally I'd like to see the add-in use a browser control so that you can view the test results as HTML.
In addition, we're also working on some abstract classes to take care of the typical set up and tear down operations - such as getting SPWeb and SPSite contexts etc. Since we don't have any REAL unit tests right now and this is all a hypothetical exercise, we'll likely just build out the abstract classes as we come up with more tests in the future.
Next time, more code, less talk!