public void DoesNotRestrictAccessForDifferentExceptions() { ErrorHandlingService.TryHandleDeprecationError(exception); AccessRestrictionStorage.DidNotReceive().SetApiOutdated(); AccessRestrictionStorage.DidNotReceive().SetClientOutdated(); }
public void DoesNotThrowForAnyExceptionWhichCanBeThrownByTheProgressObservable(Exception exception) { ErrorHandlingService.TryHandleUnauthorizedError(Arg.Any <UnauthorizedException>()).Returns(true); ErrorHandlingService.TryHandleDeprecationError(Arg.Any <ClientDeprecatedException>()).Returns(true); ErrorHandlingService.TryHandleDeprecationError(Arg.Any <ApiDeprecatedException>()).Returns(true); Action processingError = () => ProgressSubject.OnError(exception); processingError.Should().NotThrow(); }
public void SetsTheOutdatedApiVersionFlag() { var exception = new ApiDeprecatedException(request, response); ErrorHandlingService.TryHandleDeprecationError(Arg.Any <ApiDeprecatedException>()).Returns(true); ProgressSubject.OnError(exception); ErrorHandlingService.Received().TryHandleDeprecationError(Arg.Is(exception)); ErrorHandlingService.DidNotReceive().TryHandleUnauthorizedError(Arg.Is(exception)); }
public void DoesNothingWhenErrorHandlingServiceHandlesTheException() { ViewModel.Email = ValidEmail; ViewModel.Password = ValidPassword; var exception = new Exception(); LoginManager.Login(Arg.Any <Email>(), Arg.Any <Password>()) .Returns(Observable.Throw <ITogglDataSource>(exception)); ErrorHandlingService.TryHandleDeprecationError(Arg.Any <Exception>()) .Returns(true); ViewModel.LoginCommand.Execute(); ViewModel.ErrorMessage.Should().BeEmpty(); }
public void DoesNothingWhenErrorHandlingServiceHandlesTheException() { var observer = TestScheduler.CreateObserver <string>(); var exception = new Exception(); ViewModel.ErrorMessage.Subscribe(observer); LoginManager.Login(Arg.Any <Email>(), Arg.Any <Password>()) .Returns(Observable.Throw <ITogglDataSource>(exception)); ErrorHandlingService.TryHandleDeprecationError(Arg.Any <Exception>()) .Returns(true); ViewModel.Login(); TestScheduler.Start(); observer.Messages.AssertEqual( ReactiveTest.OnNext(1, "") ); }
public void RestricsAccessForClientDeprecatedException() { ErrorHandlingService.TryHandleDeprecationError(exception); AccessRestrictionStorage.Received().SetClientOutdated(); }
public void ReturnsTrueForClientDeprecatedException() { var result = ErrorHandlingService.TryHandleDeprecationError(exception); result.Should().BeTrue(); }
public void NavigatesToOutdatedAppViewModelForApiDeprecatedException() { ErrorHandlingService.TryHandleDeprecationError(exception); NavigationService.Received().Navigate <OutdatedAppViewModel>(); }
public void DoesNotNavigateForDifferentExceptions() { ErrorHandlingService.TryHandleDeprecationError(exception); NavigationService.DidNotReceive().Navigate <OutdatedAppViewModel>(); }