示例#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>();
            }