public void TestToArray() { var e = CountTo100(Thread.CurrentThread); var iter = TaskEnumerator <int> .FromEnumerable(e, 1); int[] items = (int[])Scheduler.WaitFor(iter.GetArray()); int[] expected = new int[100]; for (int i = 0; i < 100; i++) { expected[i] = i; } Assert.AreEqual(expected, items); }
public void YieldStartGetTaskIterator() { var e = CountTo100(Thread.CurrentThread); var iter = TaskEnumerator <int> .FromEnumerable(e, 1); var output = new List <int>(); var f = Scheduler.Start(IterationTask(iter, output)); Scheduler.WaitFor(f); int[] expected = new int[100]; for (int i = 0; i < 100; i++) { expected[i] = i; } Assert.AreEqual(output.ToArray(), expected); }