예제 #1
0
        public void ItIteratesThroughtCollection()
        {
            var collection = new EnemyCollection
            {
                [0] = new EasyEnemy(),
                [1] = new MediumEnemy(),
                [2] = new HardEnemy()
            };

            var iterator = collection.CreateIterator();

            var total = 0;

            for (var enemy = iterator.First(); !iterator.Done(); enemy = iterator.Next())
            {
                total++;
            }

            Assert.IsType<EnemyCollection>(collection);

            Assert.Equal(3, total);
        }