Ejemplo n.º 1
0
                public void DoesNotResetThePasswordIfEmailIsInvalid()
                {
                    ViewModel.Reset.Execute();
                    TestScheduler.Start();

                    UserAccessManager.DidNotReceive().ResetPassword(Arg.Any <Email>());
                }
Ejemplo n.º 2
0
            public void DoesNotTryToSignUpIfUserDoesNotAcceptTermsOfService()
            {
                NavigationService.Navigate <TermsOfServiceViewModel, bool>().Returns(false);

                ViewModel.GoogleSignup.Execute();

                TestScheduler.Start();
                UserAccessManager.DidNotReceive().SignUpWithGoogle(Arg.Any <bool>(), Arg.Any <int>(), Arg.Any <string>());
            }
Ejemplo n.º 3
0
            public async Task ShowsTheOutdatedViewIfTheVersionOfTheCurrentlyUsedApiIsOutdated()
            {
                AccessRestrictionStorage.IsApiOutdated().Returns(true);

                AppStart.Start();

                await NavigationService.Received().Navigate <OutdatedAppViewModel>();

                UserAccessManager.DidNotReceive().CheckIfLoggedIn();
            }
Ejemplo n.º 4
0
            public async Task ShowsTheOutdatedViewIfTheCurrentVersionOfTheAppIsOutdated()
            {
                AccessRestrictionStorage.IsClientOutdated().Returns(true);

                await Task.Run(() => AppStart.Start());

                await NavigationService.Received().Navigate <OutdatedAppViewModel>();

                UserAccessManager.DidNotReceive().GetDataSourceIfLoggedIn();
            }
Ejemplo n.º 5
0
            public async Task DoesNothingWhenValidCredentialsAreNotProvided()
            {
                var scheduler  = new TestScheduler();
                var observable = arrangeCallToPasswordManagerWithInvalidCredentials();

                ViewModel.StartPasswordManager.Execute();

                TestScheduler.Start();
                await UserAccessManager.DidNotReceive().Login(Arg.Any <Email>(), Arg.Any <Password>());
            }
Ejemplo n.º 6
0
            public async Task ShowsTheOutdatedViewIfTheCurrentVersionOfTheAppIsOutdated()
            {
                AccessRestrictionStorage.IsClientOutdated().Returns(true);

                AppStart.Start();

                await NavigationService.Received().Navigate <OutdatedAppViewModel>();

                UserAccessManager.DidNotReceive().TryInitializingAccessToUserData(out _, out _);
            }
Ejemplo n.º 7
0
            public async Task ShowsTheOutdatedViewIfTheTokenWasRevokedAndTheAppIsOutdated()
            {
                AccessRestrictionStorage.IsUnauthorized(Arg.Any <string>()).Returns(true);
                AccessRestrictionStorage.IsClientOutdated().Returns(true);

                AppStart.Start();

                await NavigationService.Received().Navigate <OutdatedAppViewModel>();

                UserAccessManager.DidNotReceive().CheckIfLoggedIn();
            }
Ejemplo n.º 8
0
            public async Task DoesNotAttemptToLoginWhileThePasswordIsNotValid()
            {
                ViewModel.Password.OnNext(InvalidPassword.ToString());
                var executionObserver = TestScheduler.CreateObserver <Unit>();

                ViewModel.Done.Execute().Subscribe(executionObserver);

                TestScheduler.Start();
                executionObserver.Messages.Last().Value.Kind.Should().Be(NotificationKind.OnError);
                await UserAccessManager.DidNotReceive().RefreshToken(Arg.Any <Password>());
            }
Ejemplo n.º 9
0
            public async Task ShowsTheOutdatedViewIfTheTokenWasRevokedAndTheApiIsOutdated()
            {
                AccessRestrictionStorage.IsUnauthorized(Arg.Any <string>()).Returns(true);
                AccessRestrictionStorage.IsApiOutdated().Returns(true);

                await Task.Run(() => AppStart.Start());

                await NavigationService.Received().Navigate <OutdatedAppViewModel>();

                await NavigationService.DidNotReceive().Navigate <TokenResetViewModel>();

                UserAccessManager.DidNotReceive().GetDataSourceIfLoggedIn();
            }
Ejemplo n.º 10
0
            public async Task DoesNotAttemptToLoginWhileThePasswordIsNotValid()
            {
                ViewModel.Password.OnNext(InvalidPassword.ToString());
                var errors = TestScheduler.CreateObserver <Exception>();

                ViewModel.Done.Errors.Subscribe(errors);

                ViewModel.Done.Execute();

                TestScheduler.Start();
                errors.Messages.Count.Should().Be(1);
                await UserAccessManager.DidNotReceive().RefreshToken(Arg.Any <Password>());
            }
Ejemplo n.º 11
0
            public async Task ShowsTheOutdatedViewIfTheTokenWasRevokedAndTheApiIsOutdated()
            {
                AccessRestrictionStorage.IsUnauthorized(Arg.Any <string>()).Returns(true);
                AccessRestrictionStorage.IsApiOutdated().Returns(true);

                AppStart.Start();

                await NavigationService.Received().Navigate <OutdatedAppViewModel>();

                await NavigationService.DidNotReceive().Navigate <TokenResetViewModel>();

                UserAccessManager.DidNotReceive().TryInitializingAccessToUserData(out _, out _);
            }
Ejemplo n.º 12
0
            public async Task DoesNotProceedWithLogoutWhenUserClicksCancelButtonInTheDialog()
            {
                ProgressSubject.OnNext(SyncProgress.Syncing);
                DialogService.Confirm(
                    Arg.Any <string>(),
                    Arg.Any <string>(),
                    Arg.Any <string>(),
                    Arg.Any <string>()).Returns(Observable.Return(false));

                ViewModel.TryLogout.Execute();
                TestScheduler.Start();

                await UserAccessManager.DidNotReceive().Logout();

                await NavigationService.DidNotReceive().Navigate <LoginViewModel>();
            }