For this to work, you need to install the NUnit Silverlight Framework.You can download the .vsi-file from here: http://www.testdriven.net/downloads/SilverlightNUnitProject.zip
This will give you this project template:
It has always been a source of great frustration for me with Silverlight, WP7 and unit testing in combination. It has remained an unsolved mystery to me why this is not possible with the native UnitTesting framework from Microsoft to author and run unit tests against your viewmodels? Come on, they are just plain assemblies (dll).
I know a specific Silverlight Unittesting framework has emerged, but I want to use the code-friendly unit testing experience that I’m used to inside Visual Studio. I don’t want to be unittesting in the phone emulator!
Anyway – forced to start using an old-time friend (NUnit) in my current work situation has actually solved the problem it seems. NUnit does not care what assemblies it is to load; it just loads them and applies the unit-test you specify! Therefore – you can use NUnit to perform the VM-unittesting you wish.
But, this requires an external GUI for running Unit tests, you might state? That is not entirely correct; an external GUI testrunner does exist, but you can also download Visual NUnit (see screenshot) from the Online Gallery inside Visual Studio. This runner can be nicely placed in your righthand side toolbox and will allow you to run unittests as easy as any other (Microsoft) framework you might think of.
The quality of these unit-tests is not dependent on what framework you are using, but on your own code.
So this is actually the way to do unit-testing of the ViewModel in a MVVM-application for the WP7 phone…