public async Task DoesNotCallPasswordManagerWhenThePasswordManagerIsNotAvailable() { PasswordManagerService.IsAvailable.Returns(false); await ViewModel.StartPasswordManager(); await PasswordManagerService.DidNotReceive().GetLoginInformation(); }
public void CallsThePasswordManagerServiceWhenTheServiceIsAvailable() { PasswordManagerService.GetLoginInformation().Returns(Observable.Never <PasswordManagerResult>()); ViewModel.StartPasswordManagerCommand.ExecuteAsync(); PasswordManagerService.Received().GetLoginInformation(); }
public void DoesNotTryToCallThePasswordManagerServiceIfItIsNotAvailable() { PasswordManagerService.IsAvailable.Returns(false); ViewModel.StartPasswordManagerCommand.Execute(); PasswordManagerService.DidNotReceive().GetLoginInformation(); }
private IObservable <PasswordManagerResult> arrangeCallToPasswordManagerWithInvalidCredentials() { var loginInfo = new PasswordManagerResult(InvalidEmail, InvalidPassword); var observable = Observable.Return(loginInfo); PasswordManagerService.GetLoginInformation().Returns(observable); return(observable); }
public async Task CallsThePasswordManagerServiceWhenTheServiceIsAvailable() { var observable = Observable.Return(new PasswordManagerResult(ValidEmail, ValidPassword)); PasswordManagerService.GetLoginInformation().Returns(observable); await ViewModel.StartPasswordManager(); await PasswordManagerService.Received().GetLoginInformation(); }
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(); }
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(); }