Is there a way to simulate switching the power source of a Win Phone 8 device from battery to external power in the Windows Phone 8 Emulator in Visual Studio 2012?
I'm developing an app that will behave differently depending on the DeviceStatus.PowerSource
value but I'm having a hard time testing and debugging since I can't simulate someone plugging in or unplugging their phone in the emulator.
For now I have worked around this by creating a Boolean property that I can control from the application UI to test the different scenarios, but this obviously isn't ideal.
The emulator doesn't have a way of configuring this.
Testing on an actual device may be a suitable alternative.
Creating your own façade which hides the actual value of the PowerSource will give you greater control and will also help when you come to write automated tests for this too.