public void CanceledTaskShouldPass() { Task task = TaskBuilder.Canceled(); Action act = () => task.Should().BeCanceled(); act.ShouldNotThrow(); }
public void ShouldAllowChainingWithAnd() { Task task = TaskBuilder.Canceled(); Action act = () => task.Should().BeCanceled().And.BeCanceled(); act.ShouldNotThrow(); }
public void ShouldAllowChainingWithWhich() { Task task = TaskBuilder.Canceled(); Action act = () => task.Should().BeCanceled().Which.IsCanceled.Should().BeTrue(); act.ShouldNotThrow(); }
public void PendingTaskShouldFailWithReasonFormatted() { Task task = TaskBuilder.Pending(); Action act = () => task.Should().BeCompletedSuccessfully("I said {0}", "so"); act.ShouldThrow <AssertFailedException>().WithMessage("Expected task to be completed successfully because I said so but was WaitingForActivation."); }
public void WithExceptionShouldPassIfAtLeastOneExceptionMatches() { Task task = TaskBuilder.Faulted(new InvalidCastException("Expected failure."), new InvalidProgramException("Other expected failure.")); Action act = () => task.Should().BeCompleted().WithException <InvalidCastException>().WithMessage("Expected failure."); act.ShouldNotThrow(); }
public void ShouldAllowChainingWithAnd() { Task task = TaskBuilder.Completed(); Action act = () => task.Should().BeCompletedSuccessfully().And.BeCompletedSuccessfully(); act.ShouldNotThrow(); }
public void CompletedTaskShouldPass() { Task task = TaskBuilder.Completed(); Action act = () => task.Should().BeCompletedSuccessfully(); act.ShouldNotThrow(); }
public void FaultedTaskShouldFailWithReason() { Task task = TaskBuilder.Faulted(); Action act = () => task.Should().BePending(because: "I said so"); act.ShouldThrow <AssertFailedException>().WithMessage("Expected task to be pending because I said so but was Faulted."); }
public void CanceledTaskShouldFail() { Task task = TaskBuilder.Canceled(); Action act = () => task.Should().BePending(); act.ShouldThrow <AssertFailedException>().WithMessage("Expected task to be pending but was Canceled."); }
public void ShouldAllowChainingWithWhich() { Task task = TaskBuilder.Pending(); Action act = () => task.Should().BePending().Which.IsCompleted.Should().BeFalse(); act.ShouldNotThrow(); }
public void PendingTaskShouldPass() { Task task = TaskBuilder.Pending(); Action act = () => task.Should().BePending(); act.ShouldNotThrow(); }
public void WithExceptionShouldFailOnNullExceptionWithReasonFormatted() { Task task = TaskBuilder.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."); }
public void WithExceptionShouldFailOnNullException() { Task task = TaskBuilder.Completed(); Action act = () => task.Should().BeCompleted().WithException <InvalidCastException>(); act.ShouldThrow <AssertFailedException>().WithMessage("Expected a <System.InvalidCastException> to be thrown, but no exception was thrown."); }
public void WithExceptionShouldFailIfNoExceptionMatches() { Task task = TaskBuilder.Faulted(new InvalidOperationException("Unexpected failure.")); Action act = () => task.Should().BeCompleted().WithException <InvalidCastException>(); act.ShouldThrow <AssertFailedException>().WithMessage("Expected a <System.InvalidCastException> to be thrown, but found a*System.InvalidOperationException with message \"Unexpected failure.\"*"); }
public void FaultedTaskShouldFail() { Task task = TaskBuilder.Faulted(); Action act = () => task.Should().BeCanceled(); act.ShouldThrow <AssertFailedException>().WithMessage("Expected task to be canceled but was Faulted."); }
public void FaultedTaskShouldPass() { Task task = TaskBuilder.Faulted(); Action act = () => task.Should().BeFaulted(); act.ShouldNotThrow(); }
public void FaultedTaskShouldFailWithReasonFormatted() { Task task = TaskBuilder.Faulted(); Action act = () => task.Should().BeCanceled("I said {0}", "so"); act.ShouldThrow <AssertFailedException>().WithMessage("Expected task to be canceled because I said so but was Faulted."); }
public void PendingTaskShouldFailWithReason() { Task task = TaskBuilder.Pending(); Action act = () => task.Should().BeFaulted(because: "I said so"); act.ShouldThrow <AssertFailedException>().WithMessage("Expected task to be faulted because I said so but was WaitingForActivation."); }
public void ShouldAllowChainingWithWhich() { Task task = TaskBuilder.Completed(); Action act = () => task.Should().BeCompletedSuccessfully().Which.IsCompleted.Should().BeTrue(); act.ShouldNotThrow(); }
public void CompletedTaskShouldFail() { Task task = TaskBuilder.Completed(); Action act = () => task.Should().BeFaulted(); act.ShouldThrow <AssertFailedException>().WithMessage("Expected task to be faulted but was RanToCompletion."); }
public void PendingTaskShouldFail() { Task task = TaskBuilder.Pending(); Action act = () => task.Should().BeCompletedSuccessfully(); act.ShouldThrow <AssertFailedException>().WithMessage("Expected task to be completed successfully but was WaitingForActivation."); }
public void ShouldAllowChaining() { Task task = TaskBuilder.Faulted(); Action act = () => task.Should().BeFaulted().BeFaulted(); act.ShouldNotThrow(); }
public void CanceledTaskShouldFail() { Task task = TaskBuilder.Canceled(); Action act = () => task.Should().BeCompletedSuccessfully(); act.ShouldThrow <AssertFailedException>().WithMessage("Expected task to be completed successfully but was Canceled."); }
public void ShouldAllowChainingWithTypedException() { Task task = TaskBuilder.Faulted(); Action act = () => task.Should().BeCompleted().WithException <InvalidCastException>().WithMessage("Expected failure."); act.ShouldNotThrow(); }