public void AllComplete_ExecutesCallbackWhenAllAreCompleted() { var run = false; var s = MockMaker.Empty<IScheduler>(); var t1 = new DelegateBasedAsyncTask(s ); var t2 = new DelegateBasedAsyncTask(s); var l = new List<AsyncTask>() { t1, t2 }; l.AllComplete((_) => { run = true; }); t1.HandleTaskCompletion(); t2.HandleTaskCompletion(); Assert.True(run); }
public void AllComplete_ReturnsDisposableThatDisposesAllRegistrations() { var run = false; var s = MockMaker.Empty<IScheduler>(); var t1 = new DelegateBasedAsyncTask(s); var t2 = new DelegateBasedAsyncTask(s); var l = new List<AsyncTask>() { t1, t2 }; l.AllComplete((_) => { run = true; }).Dispose(); t1.HandleTaskCompletion(); t2.HandleTaskDiscarded(); Assert.False(run); }