public void EnumeratesOnce() { int i = 0; var enumerable = Enumerable.Range(0, 10).Select(x => i++); var memoized = new MemoizingEnumerable<int>(enumerable); // enumerating memoized twice shouldn't matter CollectionAssert.AreEqual(memoized, memoized); }
public void ChainedMemoizingEnumerables() { var list = new int [] { 1, 2, 3, 4, 5 }; var memoized = new MemoizingEnumerable <int>(list); var memoized2 = new MemoizingEnumerable <int>(memoized); var memoized3 = new MemoizingEnumerable <int>(memoized2); CollectionAssert.AreEqual(list, memoized3); }
public void EnumeratesOnce() { int i = 0; var enumerable = Enumerable.Range(0, 10).Select(x => i++); var memoized = new MemoizingEnumerable <int>(enumerable); // enumerating memoized twice shouldn't matter CollectionAssert.AreEqual(memoized.ToList(), memoized.ToList()); }
public void EnumeratesList() { var list = new List <int> { 1, 2, 3, 4, 5 }; var memoized = new MemoizingEnumerable <int>(list); CollectionAssert.AreEqual(list, memoized); }
public void EnumeratesList() { var list = new List<int> {1, 2, 3, 4, 5}; var memoized = new MemoizingEnumerable<int>(list); CollectionAssert.AreEqual(list, memoized); }