public void Fail_should_set_exception_of_TaskCompletionSource() { var taskCompletionSource = new TaskCompletionSource <int>(); var sut = new QueueMessage <int>(null, 0, taskCompletionSource); sut.Fail(new Exception("something went wrong")); taskCompletionSource.Awaiting(t => t.Task) .Should().Throw <Exception>() .WithMessage("something went wrong"); }