Beispiel #1
0
        public static RunToCompletion Run(this IEnumerator <object> task, out IFuture future)
        {
            var rtc = new RunToCompletion(task, TaskExecutionPolicy.RunWhileFutureLives);

            future = rtc.Future;
            return(rtc);
        }
Beispiel #2
0
        IEnumerator <object> TaskReturnValueOfYieldedTask()
        {
            var tr = new RunToCompletion(TaskReturnValueOfFuture());

            yield return(tr);

            yield return(new Result(tr.Result));
        }
Beispiel #3
0
        public void RunToCompletionFailureTest()
        {
            var rtc = new RunToCompletion(CrashyTask());
            var f   = Scheduler.Start(rtc);

            while (!f.Completed)
            {
                Scheduler.Step();
            }

            Assert.AreEqual(false, f.Result);
            Assert.IsTrue(rtc.Future.Error is Exception);
            Assert.AreEqual("pancakes", rtc.Future.Error.Message);
        }