O'Reilly logo

Windows® Phone 8 Unleashed by Daniel Vaughan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Code-Driven Location Simulation

The Windows Phone emulator’s location simulator is useful for testing your app while it is executing within the emulator. To test the geo location features of your app on a physical device or within a unit test requires a different code-driven approach.

This section demonstrates how to abstract the use of the Geolocator class so that it can be replaced by a testable mock class.

On first glance you might think that mocking the SDK’s geo location API should be a simple affair. Many of the classes in the API are, however, sealed—including the Geolocator class. This makes mocking them awkward because they must be wrapped or accessed via custom proxy classes.

The Geolocator class implements an internal IGeolocator ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required