Beispiel #1
0
        public void ContinueWithで継続処理を実行できる()
        {
            var x  = 10.0;
            var x1 = Coroutines.F1(x);
            var x2 = Coroutines.F2(x1);
            var x3 = Coroutines.F3(x2);

            var task = Task.Run <double>(c => Coroutines.F1Async(x, c))
                       .OnComplete(t => Assert.AreEqual(t.Result, x1))
                       .ContinueWithIterator <string>((t, callback) => Coroutines.F2Async(t.Result, callback))
                       .OnComplete(t => Assert.AreEqual(t.Result, x2))
                       .ContinueWithIterator <int>((t, callback) => Coroutines.F3Async(t.Result, callback))
                       .OnComplete(t => Assert.AreEqual(t.Result, x2))
            ;

            var scheduler = Task.DefaultScheduler;

            scheduler.Update(30);
        }