public void should_composing_iterating_sequences() { var demoObject = new ImplIteratorUsingYieldDemoClass(); var numberStorage = new List <int>(); foreach (int number in demoObject.GetEvenNumber(demoObject.GetOneToTen())) { numberStorage.Add(number); } // change the variable value to fix the test. var expectedNumberStorage = new List <int> { 2, 4, 6, 8, 10 }; Assert.Equal(expectedNumberStorage, numberStorage); }
public void should_implement_iterator_using_yield() { var demoObject = new ImplIteratorUsingYieldDemoClass(); var numberStorage = new List <int>(); foreach (int number in demoObject.GetOneToTen()) { numberStorage.Add(number); } // change the variable value to fix the test. var expectedNumberStorage = new List <int> { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; Assert.Equal(expectedNumberStorage, numberStorage); }