If you're talking about testing C # code in a Silverlight-based project, then you need to take some steps to use frameworks like nUnit. C # code in a Silverlight project will be compiled with Silverlight binaries, so binaries for nUnit will not work as they are, since they are compiled against the standard .NET platform.
If you want to use nUnit, you can set up a regular C # class library and reference your Silverlight C # files in this project. You want to add them as a link, which is described in detail here . From personal experience, this can get a little crazy because your file is linked in two places and the ability to link files is limited (if your Silverlight C # code refers to any binary files associated with Silverlight, you cannot perform this link trick).
Another option is to use the Silverlight Unit Test Framework, binaries for which can be found here . This is very similar to the Silverlight tester in the Silverlight Toolkit, except that it runs on the phone as a phone application.
avanek
source share