public override void SetUp(UUnitTestContext testContext) { _pushRegisterApiSuccessful = false; PlayFabAndroidPushPlugin.StopPlugin(); testContext.False(PlayFabAndroidPushPlugin.IsPlayServicesAvailable(), "Play Services should not be available before setup"); PlayFabAndroidPushPlugin.OnGcmSetupStep += OnGcmSetupStep; PlayFabAndroidPushPlugin.OnGcmMessage += OnGcmMessage; ActiveTick = null; _expectedMessages.Clear(); _expectedCustom.Clear(); }
/// <summary> /// Utility for tests to pass as soon as registration is successful /// On the first successful registration, this will piggyback some tests that can only occur on a successful registration /// </summary> /// <param name="testContext"></param> protected void PassOnSuccessfulRegistration(UUnitTestContext testContext) { if (_pushRegisterApiSuccessful) { testContext.True(PlayFabAndroidPushPlugin.IsPlayServicesAvailable(), "This test should have made Play Services available"); if (!_messagesTested) { PlayFabAndroidPushPlugin.AlwaysShowOnNotificationBar(false); // For the purpose of this test, hide the notifications from the device notification tray SendImmediateNotificationsAndWait(); SendScheduledNotificationsAndWait(); ActiveTick = WaitForExpectedMessages; } else { testContext.EndTest(UUnitFinishState.PASSED, null); } } }
public override void TearDown(UUnitTestContext testContext) { PlayFabAndroidPushPlugin.StopPlugin(); testContext.False(PlayFabAndroidPushPlugin.IsPlayServicesAvailable(), "Play Services should not be available after shutdown"); PlayFabClientAPI.ForgetClientCredentials(); }