예제 #1
0
        public void Can_Add_After()
        {
            var myLinkedList = new MyLinkedList <int>();

            myLinkedList.AddFirst(1);
            myLinkedList.AddLast(2);
            myLinkedList.AddLast(4);
            myLinkedList.AddAfter(myLinkedList.GetHead().Next, 3);
            myLinkedList.GetHead().Next.Next.Data.Should().Be(3);
        }
예제 #2
0
        public void Can_Add_Before()
        {
            var myLinkedList = new MyLinkedList <int>();

            myLinkedList.AddFirst(1);
            myLinkedList.AddLast(3);
            myLinkedList.AddLast(4);
            myLinkedList.AddBefore(myLinkedList.GetHead().Next, 2);
            myLinkedList.GetHead().Next.Data.Should().Be(2);
        }
예제 #3
0
        public void Can_Add_First()
        {
            var myLinkedList = new MyLinkedList <int>();

            myLinkedList.AddFirst(1);
            myLinkedList.GetHead().Data.Should().Be(1);
        }