During my time in Japan one of the most common confusions I had was with units of measurement. Japan being a normal country, uses the metric system, unlike the US with its wacky system of units. Many times, I wish I had Google by my side to do the conversions. To correct this, I started working on app for my Windows Phone 7 that would allow me, without Internet access, to convert to and from all manner of units.
As I started developing it, it became clear that I unit tests would be a huge help because of all of the math being done. But how?
Thanks to this link (http://dotnet.dzone.com/news/test-driven-development) I came across the Silverlight Unit Testing framework from the Silverlight Toolkit. The link contains all of the direction needed to get going on this. Using it you can effectively use the Windows Phone emulator as a Test GUI.
Its no NUnit Test Runner, but it gets the point across. Curiously, if you use Assert.AreEqual and the test fails, you get the exception in the IDE as opposed to it being reported here, which is kind of weird. It still needs some work but it works. This is one of my test methods
As you can see, the framework does nothing more then allow the test results to be shown in the Windows Phone 7 Emulator, the rest is all straight MSTest.
The thing I love about writing code with unit tests, especially code involving math, is you have a degree of confidence it is right. I tend to have a hard time with the whole Red, Green, Refactor model since I tend to write code that does what I want. One of my goals is to work on a team where unit testing is huge and I can learn from smarter people the best way to integrate TDD into my coding style.