public static RunToCompletion Run(this IEnumerator <object> task, out IFuture future) { var rtc = new RunToCompletion(task, TaskExecutionPolicy.RunWhileFutureLives); future = rtc.Future; return(rtc); }
IEnumerator <object> TaskReturnValueOfYieldedTask() { var tr = new RunToCompletion(TaskReturnValueOfFuture()); yield return(tr); yield return(new Result(tr.Result)); }
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); }