Пример #1
0
        public void AddAfter(int oldItem, int item)
        {
            for (int i = 1; i <= 5; i++)
            {
                circularSinglyLinkedList.AddLast(i);
            }

            circularSinglyLinkedList.AddAfter(oldItem, item);

            Assert.AreEqual(circularSinglyLinkedList.Count(), 6, "invalid count");
            Assert.IsTrue(circularSinglyLinkedList.Contains(item), "Item doesn't exists.");
        }
Пример #2
0
        public void AddNullItem()
        {
            var list = new CircularSinglyLinkedList <string>();

            list.AddFirst(null);
            list.AddLast(null);
            list.AddAfter(null, null);
            list.AddBefore(null, null);
            Assert.AreEqual(list.Count(), 4, "invalid count");
            list.Remove(null);
            list.RemoveFirst();
            list.RemoveLast();
            Assert.AreEqual(list.Count(), 1, "invalid count");
        }