public void CanceledTaskShouldPass()
        {
            Task <bool> task = TaskResultBuilder.Canceled();

            Action act = () => task.Should().BeCompleted();

            act.ShouldNotThrow();
        }
Example #2
0
        public void CanceledTaskShouldFail()
        {
            Task <bool> task = TaskResultBuilder.Canceled();

            Action act = () => task.Should().BeCompletedSuccessfully();

            act.ShouldThrow <AssertFailedException>().WithMessage("Expected task to be completed successfully but was Canceled.");
        }
Example #3
0
        public void CanceledTaskShouldFail()
        {
            Task <bool> task = TaskResultBuilder.Canceled();

            Action act = () => task.Should().BeFaulted();

            act.ShouldThrow <AssertFailedException>().WithMessage("Expected task to be faulted but was Canceled.");
        }
Example #4
0
        public void ShouldAllowChainingWithWhich()
        {
            Task <bool> task = TaskResultBuilder.Canceled();

            Action act = () => task.Should().BeCanceled().Which.IsCanceled.Should().BeTrue();

            act.ShouldNotThrow();
        }
Example #5
0
        public void ShouldAllowChainingWithAnd()
        {
            Task <bool> task = TaskResultBuilder.Canceled();

            Action act = () => task.Should().BeCanceled().And.BeCanceled();

            act.ShouldNotThrow();
        }
Example #6
0
 public static Task Canceled()
 {
     return(TaskResultBuilder.Canceled());
 }