Пример #1
0
        public void TestAddLastRemoveFirst()
        {
            IterableLinkedList <string> list = new IterableLinkedList <string>();

            list.AddLast("3");
            list.AddLast("2");
            list.AddLast("1");
            string value;

            Assert.IsTrue(list.RemoveFirst(out value));
            Assert.AreEqual("3", value);

            Assert.IsTrue(list.RemoveFirst(out value));
            Assert.AreEqual("2", value);

            Assert.IsTrue(list.RemoveFirst(out value));
            Assert.AreEqual("1", value);
        }
Пример #2
0
        public void TestRemove()
        {
            IterableLinkedList <string> list = new IterableLinkedList <string>();

            for (int i = 0; i < 50; i++)
            {
                list.AddLast("" + i);
            }

            Assert.IsTrue(list.Remove("35"));

            string value;

            for (int i = 0; i < 49; i++)
            {
                Assert.IsTrue(list.RemoveFirst(out value));
            }

            Assert.IsFalse(list.RemoveFirst(out value));
        }