• Unit testing your Silverlight/WP7 code with Portable Library Tools?

    I’m slowly improving my knowledge of developing in Silverlight and specifically apps for Windows Phone 7. My Internode Usage app has been out for almost a month, and I’m working on an update for that (including real Internode logos now that I’ve got permission). I’ve also been creating a new app that will display the nearest public toilet (particularly useful for parents of young kids, especially if you’re travelling). That’s been fun as I’ve got to use the Map control. I hope to publish that soon.

    One thing I have missed was the ability to easily write unit tests for the code. The problem is that the code doesn’t run on your desktop, it runs in the emulator or on a device. This has meant that most of the solutions so far have relied on running the test runner on the device as a separate application. That is certainly a valid way to test, but getting the results of the test back out isn’t easy. Justin Angel describes one approach using the CoreCon API to read and write to the test app’s Isolated Storage. Another way might be to get the test runner app to push the results back out to some kind of HTTP listener running externally to the emulator.

    Enter the Portable Library Tools add-in. Just released as a CTP, this allows code to be targeted at both Windows Phone 7 and the regular CLR (as well as Silverlight and XNA) without having to jump through lots of hoops.

    It should now be possible to create a regular .NET unit testing assembly (say using MbUnit with the Gallio test runner) and run tests over most of your code, and then just recompile to have the same code be deployed to WP7.

    There will be exceptions, as you may need to refactor your code to extract out specific WP7 dependencies (that obviously have no equivalent in the desktop .NET Framework), but this looks like a promising step forward.

    One caveat is that to install the Portable Library Tools, you need to have installed VS 2010 SP1 Beta. I’m being more careful about keeping my work laptop (which has also become my main dev machine) in good working order, so I’ll be installing the SP1 beta on a separate VM just to be safe.

    I’ll do a follow-up post with my experiences. It might take a few days, as tomorrow I’m off riding in the Tour Down Under (again!), and might need a day or two to recover!

  • T Sql Int Equivalents Of Decimalnumeric

  • Trial by Media Center

    My Media Center has been misbehaving a bit lately, much to my (and the family’s) annoyance.

    First off, it the receiver started showing “tuner not available” errors. Restarting the machine would resolve the problem, but only temporarily. Installing the newer Hauppauge driver 7.9.1.28162 seems to have mostly fixed that (from the Hauppauge UK website). Along the way to resolving this, I also tried swapping the card into the other PCI Express slot, just in case that helped.

    Then the Microsoft Remote stopped working. The display on the front of the Antec case said something like “bad command” for any button I pressed. Opening up the iMON software, I enabled sounds for invalid commands, and sure enough every button press resulted in the warning sound. Bizarre! The batteries in the controller were still fresh, so the only thing I could think of was to find the original IR receiver that came with the controller and plug that in. I’d never used it as the Antec case came with a receiver built in. In any case (ha ha), that seemed to resolve that one.

    Then a few hours later, the sound spontaneously muted. Attempts to increase the volume worked briefly, then the volume would auotmatically wind back down to zero/mute. Alternatively, it rolled right up to 50 (100%). Rebooting and that one went away – not sure what’s going on there.

    So I’m keeping a close eye on things. Maybe the MCE is feeling jealous that the XBox 360 is getting some of it’s screen time Smile