Exemplo n.º 1
0
        public void CanceledTaskShouldPass()
        {
            Task <bool> task = TaskResultBuilder.Canceled();

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

            act.ShouldNotThrow();
        }
Exemplo n.º 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.");
        }
Exemplo n.º 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.");
        }
Exemplo n.º 4
0
        public void ShouldAllowChainingWithWhich()
        {
            Task <bool> task = TaskResultBuilder.Canceled();

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

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

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

            act.ShouldNotThrow();
        }
Exemplo n.º 6
0
 public static Task Canceled()
 {
     return(TaskResultBuilder.Canceled());
 }