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

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

            list.RemoveFirst();

            Assert.AreEqual("John", list.First.Value);
            Assert.AreEqual("John", list.Last.Value);
            Assert.AreEqual(1, list.Count);
        }
Beispiel #2
0
        public void Enumeration_IsNeverNull()
        {
            var list = new LALinkedList <object>();

            foreach (object o in list)
            {
                Assert.IsNotNull(o);
            }

            list.AddLast(new object());
            list.AddLast(new object());
            list.AddLast(new object());

            foreach (object o in list)
            {
                Assert.IsNotNull(o);
            }

            list.RemoveLast();

            foreach (object o in list)
            {
                Assert.IsNotNull(o);
            }

            list.RemoveFirst();

            foreach (object o in list)
            {
                Assert.IsNotNull(o);
            }

            list.Clear();

            foreach (object o in list)
            {
                Assert.IsNotNull(o);
            }
        }