Ejemplo n.º 1
0
        public void InitialUnregisterAllAsync()
        {
            var channelUri = PushHelper.GetChannel();
            var push       = this.GetClient().GetPush();

            push.UnregisterAllAsync(channelUri).Wait();
            var registrations = push.RegistrationManager.PushHttpClient.ListRegistrationsAsync(channelUri).Result;

            Assert.IsFalse(registrations.Any(), "Deleting all registrations for a channel should ensure no registrations are returned by List");

            channelUri = PushHelper.GetUpdatedChannel();
            push.UnregisterAllAsync(channelUri).Wait();
            registrations = push.RegistrationManager.PushHttpClient.ListRegistrationsAsync(channelUri).Result;
            Assert.IsFalse(registrations.Any(), "Deleting all registrations for a channel should ensure no registrations are returned by List");
        }
Ejemplo n.º 2
0
        public void RegisterNativeAsyncUnregisterNativeAsync()
        {
            var channelUri = PushHelper.GetChannel();
            var push       = this.GetClient().GetPush();

            push.RegisterNativeAsync(channelUri).Wait();
            var registrations = push.RegistrationManager.PushHttpClient.ListRegistrationsAsync(channelUri).Result;

            Assert.AreEqual(registrations.Count(), 1, "1 registration should exist after RegisterNativeAsync");
            Assert.AreEqual(
                registrations.First().RegistrationId,
                push.RegistrationManager.LocalStorageManager.GetRegistration(Registration.NativeRegistrationName).RegistrationId,
                "Local storage should have the same RegistrationId as the one returned from service");

            push.UnregisterNativeAsync().Wait();
            registrations = push.RegistrationManager.PushHttpClient.ListRegistrationsAsync(channelUri).Result;
            Assert.AreEqual(registrations.Count(), 0, "0 registrations should exist in service after UnregisterNativeAsync");
            Assert.IsNull(
                push.RegistrationManager.LocalStorageManager.GetRegistration(Registration.NativeRegistrationName),
                "Local storage should not contain a native registration after UnregisterNativeAsync.");
        }