public void Can_Add_First() { var myLinkedList = new MyLinkedList <int>(); myLinkedList.AddFirst(1); myLinkedList.GetHead().Data.Should().Be(1); }
public void Can_Add_Last() { var myLinkedList = new MyLinkedList <int>(); myLinkedList.AddLast(1); myLinkedList.AddLast(2); myLinkedList.AddFirst(3); myLinkedList.GetLast().Data.Should().Be(2); }
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); }
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); }
public void Can_Travel_All() { var myLinkedList = new MyLinkedList <int>(); myLinkedList.AddFirst(1); myLinkedList.AddLast(2); myLinkedList.AddLast(3); var list = myLinkedList.ToList(); list[0].Should().Be(1); list[1].Should().Be(2); list[2].Should().Be(3); list.Count.Should().Be(3); }