[MSetup] public void Setup() { if (!IsTestRunningInPlayingMode()) { SkipCurrentTest("Purchase feature should run on MainThread."); } ; var done = false; // overwrite Autoya instance for test purchase feature. RunEnumeratorOnMainThread( WaitPurchaseFeatureOfAutoya( () => { done = true; } ), false ); WaitUntil( () => done, 10, "failed to ready." ); if (!done) { SkipCurrentTest("Purchase feature test setup is failed to ready."); return; } // shutdown purchase feature for get valid result from Unity IAP. Autoya.Purchase_Shutdown(); RunOnMainThread( () => { router = new PurchaseRouter( iEnum => { RunEnumeratorOnMainThread(iEnum, false); }, productData => { // dummy response. return(new ProductInfo[] { new ProductInfo("100_gold_coins", "100_gold_coins_iOS", true, "one hundled of coins."), new ProductInfo("1000_gold_coins", "1000_gold_coins_iOS", true, "one ton of coins.") }); }, ticketData => ticketData, () => {}, (err, reason, status) => {} ); } ); WaitUntil(() => router.IsPurchaseReady(), 5, "failed to ready."); }