public void EnumeratorDisposal() { var e = new TestEnumerator(); var iter = TaskEnumerator <object> .FromEnumerator(e, 1); Scheduler.WaitFor(iter.Fetch()); iter.Dispose(); Assert.IsTrue(e.Disposed); }
public void TestIterateSequence() { using (var iter = new TaskEnumerator <int>(CountToThree(), 1)) { for (int i = 1; i <= 3; i++) { Assert.IsFalse(iter.Disposed); Scheduler.WaitFor(iter.Fetch()); using (var e = iter.CurrentItems) { Assert.IsTrue(e.MoveNext()); Assert.AreEqual(i, e.Current); Assert.IsFalse(e.MoveNext()); } } } }