예제 #1
0
파일: Util.cs 프로젝트: jli94/Fracture
        public static RunToCompletion Run(this IEnumerator <object> task, out IFuture future)
        {
            var rtc = new RunToCompletion(task, TaskExecutionPolicy.RunWhileFutureLives);

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

            yield return(tr);

            yield return(new Result(tr.Result));
        }
예제 #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);
        }