public void TrySetError_Should_Not_RejectTask_WithDefaultException() { var source = new PandaTaskCompletionSource(); source.SetError(); Assert.IsFalse(source.TrySetError()); }
public void TrySetError_Should_RejectTask_WithDefaultException() { var source = new PandaTaskCompletionSource(); Assert.IsTrue(source.TrySetError()); Assert.That(source.Task.Status, Is.EqualTo(PandaTaskStatus.Rejected)); Assert.That(source.Task.Error, Is.InstanceOf <TaskRejectedException>()); }
public void TrySetError_Should_Not_RejectTask_WithSpecificException() { var source = new PandaTaskCompletionSource(); var exception = new ArgumentException(); source.SetError(exception); Assert.IsFalse(source.TrySetError(exception)); }
public void TrySetError_Should_RejectTask_WithSpecificException() { var source = new PandaTaskCompletionSource(); var exception = new ArgumentException(); Assert.IsTrue(source.TrySetError(exception)); Assert.That(source.Task.Status, Is.EqualTo(PandaTaskStatus.Rejected)); Assert.That(source.Task.Error, Is.EqualTo(exception)); }
public void TrySetErrorTResult_Should_Throw_WithNullException() { var source = new PandaTaskCompletionSource <int>(); Assert.That(() => source.TrySetError(null), Throws.ArgumentNullException); }