コード例 #1
0
 public void IncompleteDeferral_PreventsCompletion()
 {
     Test.Async(async () =>
     {
         var dm = new DeferralManager();
         var deferral = dm.GetDeferral();
         await AssertEx.NeverCompletesAsync(dm.SignalAndWaitAsync());
     });
 }
コード例 #2
0
 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);
     });
 }
コード例 #3
0
 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;
     });
 }
コード例 #4
0
 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;
     });
 }
コード例 #5
0
 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);
     });
 }
コード例 #6
0
ファイル: DeferralManager.cs プロジェクト: zhenlei520/AsyncEx
 public ManagedDeferralSource(DeferralManager manager)
 {
     _manager = manager;
 }
コード例 #7
0
 public void NoDeferrals_IsCompleted()
 {
     var dm = new DeferralManager();
     var task = dm.SignalAndWaitAsync();
     Assert.IsTrue(task.IsCompleted);
 }