public void IncompleteDeferral_PreventsCompletion() { Test.Async(async () => { var dm = new DeferralManager(); var deferral = dm.GetDeferral(); await AssertEx.NeverCompletesAsync(dm.SignalAndWaitAsync()); }); }
public void MultipleDeferralsWithOneIncomplete_PreventsCompletion() { Test.Async(async () => { var dm = new DeferralManager(); var deferral1 = dm.GetDeferral(); var deferral2 = dm.GetDeferral(); var task = dm.SignalAndWaitAsync(); deferral1.Dispose(); await AssertEx.NeverCompletesAsync(task); }); }
public void DeferralCompleted_Completes() { Test.Async(async () => { var dm = new DeferralManager(); var deferral = dm.GetDeferral(); var task = dm.SignalAndWaitAsync(); Assert.IsFalse(task.IsCompleted); deferral.Dispose(); await task; }); }
public void MultipleDeferralsWithAllCompleted_Completes() { AsyncContext.Run(async () => { var dm = new DeferralManager(); var deferral1 = dm.GetDeferral(); var deferral2 = dm.GetDeferral(); var task = dm.SignalAndWaitAsync(); deferral1.Dispose(); deferral2.Dispose(); await task; }); }
public void TwoDeferralsWithOneCompletedTwice_PreventsCompletion() { AsyncContext.Run(async () => { var dm = new DeferralManager(); var deferral1 = dm.GetDeferral(); var deferral2 = dm.GetDeferral(); var task = dm.SignalAndWaitAsync(); deferral1.Dispose(); deferral1.Dispose(); await AssertEx.NeverCompletesAsync(task); }); }
public ManagedDeferralSource(DeferralManager manager) { _manager = manager; }
public void NoDeferrals_IsCompleted() { var dm = new DeferralManager(); var task = dm.SignalAndWaitAsync(); Assert.IsTrue(task.IsCompleted); }