public void AsyncCommandTimeoutInTaskTest() { this.RunCommandTimeoutTest(properties => { TestAsyncCommand command = new TestAsyncCommand(properties); command.DelayExecutionTask = true; return(command); }); }
public void ObservableOnCompletedTest() { TestAsyncCommand command = new TestAsyncCommand(); bool wasCompleted = false; command.GetExecutionObservable().Subscribe(_ => { }, () => wasCompleted = true); wasCompleted.Should().BeTrue(); }
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>(); }
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); }
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>(); }