Tuesday, March 23, 2010

xUnit Frameworks incompatible with Silverlight for Windows Phone 7 (.NET Compact Framework)

When I first started building my blog entry on Building a Windows Phone 7 app with MVVM pattern, using TDD and mock objects, I started out using VS 2010 RC and NUnit, using the project templates from the Silverlight for Windows Phone project. I didn't get far through my tests until I hit testing with ICommand (for MVVM) and hit a show-stoppping error. At that point, I switched over to using Visual Studio 2010 Express for WinPhone and the Silverlight Unit Testing Framework.

Some discussions came up yesterday about what exactly Silverlight for Win Phone 7 (which runs under .NET Compact Framework) would and wouldn't support. Essentially most xUnit frameworks theoretically won't work because there is no support for Reflection.Emit in NETCF.

I wanted to go back and confirm what the error was I had hit with NUnit, so I redid the project in scratch in VS 2010 RC with NUnit and took it as far as it would go. As before, it hit the wall with ICommand. Here is the error that is generated:

1 comment:

Brian said...

Make sure that all the DLLs you expect to be there are in the Test bin folder... I have found in a few cases that there are some missing DLLs. Never figured it out... but I just copied it over and the tests tarted running... at least, that is what I found with classic SL.