Testing with the simulator
Much of what we have looked at uses the CurrentApp
class, which connects to the associated Windows Store account to process the transactions. This requires that any IAP products exist in the dashboard, and really gets in the way of any sort of testing before you submit your game. To get around this, the CurrentAppSimulator
class allows us to test the different scenarios to ensure that our trial mode and the IAP code work fine. The simulator also allows you to test without even creating the app in the store dashboard, instead using a local XML file that describes the game and any IAP products that can be sold to populate the different listings and license details.
To get started with this, we need to replace all instances of the CurrentApp
class with the CurrentAppSimulator
. This can be easily accomplished using a preprocessor directive for DEBUG
builds, and some typedefs
to abstract the CurrentApp
and CurrentAppSimulator
based on the build configuration.
#if DEBUG...