Porting Code and Unit Tests to the device:
After much work, we ported the source code and unit tests from the desktop versions of CompositeUI, CompositeUI.Winforms, and ObjectBuilder projects to corresponding Windows Mobile 5.0 Pocket PC projects. We even got the unit tests to pass when run on the VSTS unit tester. We're done right? Wrong.
In order to get a real sense of completion, we need to run our unit tests on the device, as opposed to the VSTS test runner that runs on the desktop. After some searching, we did not find a suitable tool, so we wrote our own: CFUnitTester.
After running the Mobile CAB and ObjectBuilder unit tests on a device via CFUnitTester, we found remarkable differences in the way our code ran on the desktop versus on a device. One difference being that on the desktop, there is an app domain versus none on the device. After fixing our code and updating our tests, we were finally able to get all unit tests to pass on both VSTS test runner and CFUnitTester.
Looking back at this experience, I could not imagine how long it would have taken to port CAB and ObjectBuilder if it weren't for the large number of unit tests. Thank you CAB and ObjectBuilder teams for your test driven development. You saved us months of work!!!
Adapting VSTS Test Classes to Run on CFUnitTester:
#if PocketPC using Microsoft.Practices.Mobile.TestTools.UnitTesting; #else using Microsoft.VisualStudio.TestTools.UnitTesting; #endif