public void MultipleYieldersOnFutureTest() { this.TestFuture = new Future <object>(); var futures = new List <IFuture>(); for (int i = 0; i < 10; i++) { futures.Add(Scheduler.Start(TaskReturnValueOfFuture())); } Scheduler.Step(); foreach (IFuture f in futures) { Assert.IsFalse(f.Completed); } TestFuture.Complete(10); Scheduler.Step(); foreach (IFuture f in futures) { Assert.IsTrue(f.Completed); Assert.AreEqual(10, f.Result); } }
public void RecursiveYieldTest() { this.TestFuture = new Future <object>(); var future = Scheduler.Start(TaskReturnValueOfYieldedTask()); Scheduler.Step(); TestFuture.Complete(10); Scheduler.Step(); Assert.AreEqual(10, future.Result); }