public async Task ClearsThePushNotificationsTokenStorage() { PushNotificationsTokenService.Token.Returns(new PushNotificationsToken("token")); pushNotificationsTokenStorage.PreviouslyRegisteredToken.Returns(new PushNotificationsToken("token")); await interactor.Execute(); pushNotificationsTokenStorage.Received().Clear(); }
public async Task StoresTheTokenWhenSucceedsToRegisterIt() { pushNotificationsTokenStorage.PreviouslyRegisteredToken.Returns(default(PushNotificationsToken)); var expectedPushNotificationToken = new PushNotificationsToken("tokenA"); PushNotificationsTokenService.Token.Returns(expectedPushNotificationToken); pushServicesApi.Subscribe(Arg.Any <PushNotificationsToken>()).Returns(Observable.Return(Unit.Default)); (await interactor.Execute().SingleAsync()).Should().Be(Unit.Default); pushNotificationsTokenStorage.Received().StoreRegisteredToken(expectedPushNotificationToken, now); }