Beispiel #1
0
        public void Remove()
        {
            var list = new LALinkedList <string>();

            list.Remove("John");

            list.AddLast("John");
            list.AddLast("Fred");
            list.AddLast("Sam");

            list.Remove(null);

            Assert.AreEqual(3, list.Count);

            list.Remove("Fred");

            Assert.IsTrue(!list.Contains("Fred"));
            Assert.AreEqual(2, list.Count);

            list.Remove("John");

            Assert.IsTrue(!list.Contains("John"));
            Assert.AreEqual(1, list.Count);

            list.Remove("Sam");

            Assert.IsTrue(!list.Contains("Sam"));
            Assert.AreEqual(0, list.Count);
        }
Beispiel #2
0
        public void Contains()
        {
            var list = new LALinkedList <string>();

            list.AddFirst("John");
            list.AddFirst("Fred");

            Assert.IsTrue(list.Contains("John"));
            Assert.IsTrue(list.Contains("Fred"));
            Assert.IsFalse(list.Contains("Sam"));
            Assert.IsFalse(list.Contains(null));
        }