Example #1
0
            public async Task DoesNotCallPasswordManagerWhenThePasswordManagerIsNotAvailable()
            {
                PasswordManagerService.IsAvailable.Returns(false);

                await ViewModel.StartPasswordManager();

                await PasswordManagerService.DidNotReceive().GetLoginInformation();
            }
Example #2
0
            public void CallsThePasswordManagerServiceWhenTheServiceIsAvailable()
            {
                PasswordManagerService.GetLoginInformation().Returns(Observable.Never <PasswordManagerResult>());

                ViewModel.StartPasswordManagerCommand.ExecuteAsync();

                PasswordManagerService.Received().GetLoginInformation();
            }
Example #3
0
            public void DoesNotTryToCallThePasswordManagerServiceIfItIsNotAvailable()
            {
                PasswordManagerService.IsAvailable.Returns(false);

                ViewModel.StartPasswordManagerCommand.Execute();

                PasswordManagerService.DidNotReceive().GetLoginInformation();
            }
Example #4
0
            private IObservable <PasswordManagerResult> arrangeCallToPasswordManagerWithInvalidCredentials()
            {
                var loginInfo  = new PasswordManagerResult(InvalidEmail, InvalidPassword);
                var observable = Observable.Return(loginInfo);

                PasswordManagerService.GetLoginInformation().Returns(observable);

                return(observable);
            }
Example #5
0
            public async Task CallsThePasswordManagerServiceWhenTheServiceIsAvailable()
            {
                var observable = Observable.Return(new PasswordManagerResult(ValidEmail, ValidPassword));

                PasswordManagerService.GetLoginInformation().Returns(observable);

                await ViewModel.StartPasswordManager();

                await PasswordManagerService.Received().GetLoginInformation();
            }
Example #6
0
            public async Task TracksThePasswordManagerContainsValidEmail()
            {
                PasswordManagerService.IsAvailable.Returns(true);
                var loginInfo  = new PasswordManagerResult(ValidEmail, InvalidPassword);
                var observable = Observable.Return(loginInfo);

                PasswordManagerService.GetLoginInformation().Returns(observable);

                await ViewModel.StartPasswordManager();

                AnalyticsService.PasswordManagerButtonClicked.Received().Track();
                AnalyticsService.PasswordManagerContainsValidEmail.Received().Track();
                AnalyticsService.PasswordManagerContainsValidPassword.DidNotReceive().Track();
            }
Example #7
0
            public void DoesNothingWhenCalledASecondTimeBeforeTheObservableFromTheFirstCallReturns()
            {
                var scheduler = new TestScheduler();
                var never     = Observable.Never <PasswordManagerResult>();

                PasswordManagerService.GetLoginInformation().Returns(never);

                scheduler.Schedule(TimeSpan.FromTicks(20), () => ViewModel.StartPasswordManagerCommand.ExecuteAsync());
                scheduler.Schedule(TimeSpan.FromTicks(40), () => ViewModel.StartPasswordManagerCommand.ExecuteAsync());

                scheduler.Start();

                PasswordManagerService.Received(1).GetLoginInformation();
            }