Esempio n. 1
0
        public void RemovingLastTailIsShiftedToNewValue()
        {
            var list = new CircularlyLinkedList <int>();

            list.AddFirst(1);
            list.AddLast(2);
            list.AddLast(3);
            list.AddLast(4);
            list.RemoveLast();
            Assert.Equal(3, list.Tail.Value);
        }
Esempio n. 2
0
        public void AddingAndRemovingIncrementsAndDecrementsTheCount()
        {
            var list = new CircularlyLinkedList <int>();

            list.AddFirst(1);
            list.AddAfter(list.Find(1), 3);
            list.AddBefore(list.Find(3), 2);
            list.AddLast(4);
            Assert.Equal(4, list.Count);
            list.RemoveFirst();
            list.RemoveLast();
            list.Remove(3);
            Assert.Equal(1, list.Count);
        }