Пример #1
0
        public static void Main()
        {
            IListIterator list = null;

            var input = string.Empty;

            while ((input = Console.ReadLine()) != "END")
            {
                try
                {
                    var tokens = input.Split();

                    switch (tokens[0])
                    {
                    case "Create":
                        var collection = new List <string>(tokens.Skip(1));
                        list = new ListIterator(collection);
                        break;

                    case "Move":
                        Console.WriteLine(list.Move());
                        break;

                    case "HasNext":
                        Console.WriteLine(list.HasNext());
                        break;

                    case "Print":
                        Console.WriteLine(list.Print());
                        break;
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
        }
Пример #2
0
        public void HasNextShouldReturnFalseWhenThereIsNoNextElement()
        {
            ListIterator listIterator = new ListIterator("a");

            Assert.That(listIterator.HasNext() == false);
        }
Пример #3
0
        public void HasNextShouldReturnTrueWhenThereIsNextElement()
        {
            ListIterator listIterator = new ListIterator("a", "b");

            Assert.That(listIterator.HasNext() == true);
        }