Esempio n. 1
0
        public void TestSkipSomeElements()
        {
            List <string> list = new List <string>();

            list.Add("1");
            list.Add("2");
            list.Add("3");

            CIterator <string> iter = new CIterator <string>(list);

            Assert.IsTrue(iter.HasNext());
            iter.Skip();

            Assert.IsTrue(iter.HasNext());
            Assert.AreEqual(list [1], iter.Next());

            Assert.IsTrue(iter.HasNext());
            iter.Skip();

            Assert.IsFalse(iter.HasNext());
        }
Esempio n. 2
0
        public void TestSkipMultiple()
        {
            List <string> list = new List <string>();

            list.Add("1");
            list.Add("2");
            list.Add("3");

            CIterator <string> iter = new CIterator <string>(list);

            iter.Skip(2);
            Assert.IsTrue(iter.HasNext());
            Assert.AreEqual(list[2], iter.Next());
        }
Esempio n. 3
0
        public void TestSkip()
        {
            List <string> list = new List <string>();

            list.Add("1");
            list.Add("2");
            list.Add("3");

            int iterations = 0;

            CIterator <string> iter = new CIterator <string>(list);

            while (iter.HasNext())
            {
                iter.Skip();
                ++iterations;
            }

            Assert.AreEqual(list.Count, iterations);
        }