Ejemplo n.º 1
0
 public void AsyncCommandTimeoutInTaskTest()
 {
     this.RunCommandTimeoutTest(properties =>
     {
         TestAsyncCommand command   = new TestAsyncCommand(properties);
         command.DelayExecutionTask = true;
         return(command);
     });
 }
Ejemplo n.º 2
0
        public void ObservableOnCompletedTest()
        {
            TestAsyncCommand command = new TestAsyncCommand();

            bool wasCompleted = false;

            command.GetExecutionObservable().Subscribe(_ => { }, () => wasCompleted = true);

            wasCompleted.Should().BeTrue();
        }
Ejemplo n.º 3
0
        public void ObservableOnBadRequestExceptionTest()
        {
            TestAsyncCommand command = new TestAsyncCommand();

            command.ExceptionToThrow = new BadRequestException("test", "test error");
            IObservable <string> observable = command.GetExecutionObservable();

            Exception actualException = null;

            observable.Subscribe(_ => { }, ex => actualException = ex);

            actualException.Should().NotBeNull();
            actualException.Should().BeOfType <BadRequestException>();
        }
Ejemplo n.º 4
0
        public void ObservableOnNextTest()
        {
            TestAsyncCommand command          = new TestAsyncCommand();
            const string     expectedResponse = "test";

            command.Response = expectedResponse;
            IObservable <string> observable = command.GetExecutionObservable();

            string actualResponse = null;

            observable.Subscribe(response => actualResponse = response);

            actualResponse.ShouldBeEquivalentTo(expectedResponse);
        }
Ejemplo n.º 5
0
        public void ObservableOnUnhandledCommandExceptionTest()
        {
            TestAsyncCommand command = new TestAsyncCommand();

            command.ExceptionToThrow = new InvalidOperationException("test error");
            IObservable <string> observable = command.GetExecutionObservable();

            Exception actualException = null;

            observable.Subscribe(_ => { }, ex => actualException = ex);

            actualException.Should().NotBeNull();
            actualException.Should().BeOfType <UnhandledCommandException>();
            actualException.InnerException.Should().BeOfType <InvalidOperationException>();
        }