public void PerformanceTest_CachedList() { Counter counter = new Counter(); CachedList <int> numbersCachedList = new CachedList <int>(getNaturalNumbers(counter)); Assert.AreEqual(0, counter.Value, "First/counter/0"); IEnumerable <int> seq1 = numbersCachedList.Take(n1), seq2 = numbersCachedList.Take(n2); Assert.AreEqual(n1 - 1, seq1.LastOrDefault(), "First/n1"); Assert.AreEqual(n1, counter.Value, "First/counter/1"); Assert.AreEqual(n2 - 1, seq2.LastOrDefault(), "First/n2"); Assert.AreEqual(n2, counter.Value, "First/counter/2"); Assert.AreEqual(n1 - 1, seq1.LastOrDefault(), "Second/n1"); Assert.AreEqual(n2, counter.Value, "Second/counter/1"); Assert.AreEqual(n2 - 1, seq2.LastOrDefault(), "Second/n2"); Assert.AreEqual(n2, counter.Value, "Second/counter/2"); IEnumerable <int> seq3 = numbersCachedList.Take(n3), seq4 = numbersCachedList.Take(n4), seq5 = numbersCachedList.Take(n5); Assert.AreEqual(n3 - 1, seq3.LastOrDefault(), "First/n3"); Assert.AreEqual(n3, counter.Value, "First/counter/3"); Assert.AreEqual(n4 - 1, seq4.LastOrDefault(), "First/n4"); Assert.AreEqual(n4, counter.Value, "First/counter/4"); Assert.AreEqual(n5 - 1, seq5.LastOrDefault(), "First/n5"); Assert.AreEqual(n5, counter.Value, "First/counter/5"); }