Tuesday, 25 September 2012

How to: Build Testable Windows Phone Applications

An earlier post outlined the Building Testable Windows Phone Applications guidance I’d developed with Patterns and Practices. At the time of release of this guidance I wrote an article for the MSDN Flash UK newsletter, that demonstrates how to build a testable Windows Phone application that consumes accelerometer data.

The key to building testable Windows Phone applications is to abstract the classes in the Windows Phone SDK. An interface can be generated for the required class in the Windows Phone SDK that contains the desired functionality for your application. Adapters, which are wrapper classes that implement the generated interface, can also be generated. Adapter classes pass parameters and return values to and from the underlying Windows Phone SDK class. The adapter translates calls to its interface into calls to the original interface. Creating adapters enables you to write loosely coupled testable code.

For more information, see How to: Build Testable Windows Phone Applications.

1 comment: