Пример #1
0
            public void DoesNotRestrictAccessForDifferentExceptions()
            {
                ErrorHandlingService.TryHandleDeprecationError(exception);

                AccessRestrictionStorage.DidNotReceive().SetApiOutdated();
                AccessRestrictionStorage.DidNotReceive().SetClientOutdated();
            }
Пример #2
0
            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();
            }
Пример #3
0
            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));
            }
Пример #4
0
                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();
                }
Пример #5
0
                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, "")
                        );
                }
Пример #6
0
            public void RestricsAccessForClientDeprecatedException()
            {
                ErrorHandlingService.TryHandleDeprecationError(exception);

                AccessRestrictionStorage.Received().SetClientOutdated();
            }
Пример #7
0
            public void ReturnsTrueForClientDeprecatedException()
            {
                var result = ErrorHandlingService.TryHandleDeprecationError(exception);

                result.Should().BeTrue();
            }
Пример #8
0
            public void NavigatesToOutdatedAppViewModelForApiDeprecatedException()
            {
                ErrorHandlingService.TryHandleDeprecationError(exception);

                NavigationService.Received().Navigate <OutdatedAppViewModel>();
            }
Пример #9
0
            public void DoesNotNavigateForDifferentExceptions()
            {
                ErrorHandlingService.TryHandleDeprecationError(exception);

                NavigationService.DidNotReceive().Navigate <OutdatedAppViewModel>();
            }