public void EventuallySetFromTaskGeneric() { var r1 = new TaskCompletionSource<int>(); var r2 = new TaskCompletionSource<int>(); var t3 = r1.EventuallySetFromTask(r2.Task); r1.Task.AssertNotCompleted(); t3.AssertNotCompleted(); r2.SetResult(1); t3.AssertRanToCompletion(); r1.Task.AssertRanToCompletion().AssertEquals(1); r1.EventuallySetFromTask(r2.Task).AssertFailed<InvalidOperationException>(); }
public void EventuallySetFromTaskVoid() { var r1 = new TaskCompletionSource(); var r2 = new TaskCompletionSource(); var t3 = r1.EventuallySetFromTask(r2.Task); r1.Task.AssertNotCompleted(); t3.AssertNotCompleted(); r2.SetRanToCompletion(); t3.AssertRanToCompletion(); r1.Task.AssertRanToCompletion(); r1.EventuallySetFromTask(r2.Task).AssertFailed<InvalidOperationException>(); }