예제 #1
0
        public void TestAddBeforeAndAfterRemoveFirst()
        {
            IterableLinkedList <string> list = new IterableLinkedList <string>();

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

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

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

            Assert.IsTrue(list.RemoveFirst(out value));
            Assert.AreEqual("3", 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));
        }