示例#1
0
        public void AllComplete_ExecutesCallbackWhenSomeDiscardedSomeCompleted()
        {
            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.HandleTaskDiscarded();
            t2.HandleTaskCompletion();

            Assert.True(run);
        }
示例#2
0
        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);
        }