Silverlight NUnit ProjectsI’ve been doing some experiments to find out
November 30, 2008 – 3:00 amI’ve been doing some experiments to find out if it’s possible to execute NUnit on a Silverlight project. I knew that Visual Studio 2008 and Expression Blend both host Silverlight for use in the designer window. It turns out that rather than host a separate instance of the CoreCLR, the designer simply loads the Silverlight assemblies into the host runtime. This simplifies the business of creating a compatible unit testing framework considerably!
With a little bit twiddling, I’ve managed to tweak the ‘nunit.framework’ assembly so that it’s compatible with Silverlight projects. In order for your tests to execute successfully, you also need to ensure that all Silverlight assemblies (except ‘mscorlib’) are set to ‘Copy Local: True’. After this is done you can run, debug and even do code coverage on your Silverlight unit tests!
Because creating one of these projects is a fiddle to set up, I’ve created Silverlight NUnit Project template that does the work for you. To install the template simply open the ‘SilverlightNUnitProject.vsi’ file and ignore the unsigned content warning. Once installed, you will find it under the ‘Visual C# / Silverlight’ section of the ‘New Project’ dialog. You can download the template from here.
To execute one or more unit tests you should use ‘Run Test(s)’ rather than ‘Test With > Silverlight’.

In summary you now have 3 options when testing Silverlight projects.
- For unit testing you can create a Silverlight NUnit Project and use the usual TestDriven.Net commands.
- For integration testing (within the context of a browser) you can use the Silverlight Testing Framework.
- For spelunking individual methods inside the CoreCLR you can use ‘Test With > Silverlight‘.
I’d be interested to hear how you get on.
PowerShell Bloggers via Yahoo Pipes
Jakul has created a Yahoo Pipes mashup, PowerShell Bloggers, that keeps up with (at present) 42 separate PowerShell (or PowerShell related) web logs. This includes my own Scripts blog! This is both a useful end product to help folks keep up with other community generated content, but Pipes is also a
Thomas Lee
Can Windows 7 Save Microsoft From Itself?
I think we can safely say that Windows Vista was a flop. The only one that doesn’t seem to know it is Microsoft. Or does it? This week at WinHEC, the company introduced a series of capabilities in Windows 7 that it says will “make it easier for hardware partners to create new experiences for Windows PC customers.” The move is intended to “rally hardware engineers to begin development and testing” for its nascent operating system. According to a recent report on downloadsquad.com, Windows 7 could be available as soon as soon as the middle of next year, but Microsoft’s original promise in 2007…
ANN: Smart Device Framework 2.3
Today, we released Smart Device Framework 2.3. This is the long awaited release of the Smart Device Framework for Visual Studio 2008. It’s been a painful path to get to this point, what with contending with frustrating bugs in Visual Studio 2008 forms designer and all, but we finally got the
Neil Cowburn

You must be logged in to post a comment.