コード例 #1
0
        public void ConstructorWithSequentialClassLoop()
        {
            var collection = TestIEnumarableData();

            CollectionProvider <TestData> provider = new CollectionProvider <TestData>(collection);

            // go over all elements, and go back to head of list
            for (int i = 0; i < collection.Count(); i++)
            {
                provider.MoveNext(null);
            }

            Assert.Equal(collection.First(), provider.Current);
        }
コード例 #2
0
        public void ConstructorWithSequentialInteger()
        {
            var collection = TestIEnumarableInt();

            CollectionProvider <int> provider = new CollectionProvider <int>(collection);
            List <int> temp = new List <int>();

            for (int i = 0; i < collection.Count(); i++)
            {
                temp.Add(provider.Current);
                provider.MoveNext(null);
            }

            Assert.Equal(temp, collection);
        }