コード例 #1
0
            public async ThreadingTask SetsTheUnauthorizedAccessFlag()
            {
                var exception = new UnauthorizedException(request, response);

                ApiErrorHandlingService.TryHandleUnauthorizedError(Arg.Any <UnauthorizedException>()).Returns(true);

                ProgressSubject.OnError(exception);

                ApiErrorHandlingService.Received().TryHandleUnauthorizedError(Arg.Is(exception));
            }
コード例 #2
0
            public void DoesNotThrowForAnyExceptionWhichCanBeThrownByTheProgressObservable(Exception exception)
            {
                ApiErrorHandlingService.TryHandleUnauthorizedError(Arg.Any <UnauthorizedException>()).Returns(true);
                ApiErrorHandlingService.TryHandleDeprecationError(Arg.Any <ClientDeprecatedException>()).Returns(true);
                ApiErrorHandlingService.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);

                ApiErrorHandlingService.TryHandleDeprecationError(Arg.Any <ApiDeprecatedException>()).Returns(true);

                ProgressSubject.OnError(exception);

                ApiErrorHandlingService.Received().TryHandleDeprecationError(Arg.Is(exception));
                ApiErrorHandlingService.DidNotReceive().TryHandleUnauthorizedError(Arg.Is(exception));
            }
コード例 #4
0
            public void UnsubscribesFromTheBackgroundServiceObservableWhenExceptionIsCaught()
            {
                var subject = new Subject <TimeSpan>();

                BackgroundService.AppResumedFromBackground.Returns(subject.AsObservable());
                DataSource.StartSyncing();
                SyncManager.ClearReceivedCalls();
                var exception = new UnauthorizedException(request, response);

                ApiErrorHandlingService.TryHandleUnauthorizedError(Arg.Any <UnauthorizedException>()).Returns(true);

                ProgressSubject.OnError(exception);
                subject.OnNext(MinimumTimeInBackgroundForFullSync + TimeSpan.FromSeconds(1));

                SyncManager.DidNotReceive().ForceFullSync();
            }
コード例 #5
0
            public void ThrowsForDifferentException(Exception exception)
            {
                Action handling = () => ProgressSubject.OnError(exception);

                handling.Should().Throw <ArgumentException>();
            }