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

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

            list.Clear();

            Assert.IsNull(list.First);
            Assert.IsNull(list.Last);
            Assert.AreEqual(0, list.Count);
        }
Пример #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);
            }
        }