public void WithExceptionShouldFailOnNullExceptionWithReasonFormatted()
        {
            Task <bool> task = TaskResultBuilder.Completed();

            Action act = () => task.Should().BeCompleted().WithException <InvalidCastException>("I said {0}", "so");

            act.ShouldThrow <AssertFailedException>().WithMessage("Expected a <System.InvalidCastException> to be thrown because I said so, but no exception was thrown.");
        }
Beispiel #2
0
        public void ShouldAllowChainingWithWhich()
        {
            Task <bool> task = TaskResultBuilder.Completed();

            Action act = () => task.Should().BeCompletedSuccessfully().Which.IsCompleted.Should().BeTrue();

            act.ShouldNotThrow();
        }
        public void CompletedTaskShouldPass()
        {
            Task <bool> task = TaskResultBuilder.Completed();

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

            act.ShouldNotThrow();
        }
Beispiel #4
0
        public void CompletedTaskShouldFail()
        {
            Task <bool> task = TaskResultBuilder.Completed();

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

            act.ShouldThrow <AssertFailedException>().WithMessage("Expected task to be faulted but was RanToCompletion.");
        }
Beispiel #5
0
 public static Task Completed()
 {
     return(TaskResultBuilder.Completed());
 }