public void Ctor_SingleLinkedList_IsEmpty() { SingleLinkedList <int> emptyList = new SingleLinkedList <int>(); int[] numbers = emptyList.ToArray(); Assert.AreEqual(0, numbers.Length); }
public void InsertAtEnd_EmptySingleLinkedList_ReturnsProperValue() { SingleLinkedList <int> list = new SingleLinkedList <int>(); list.InsertAtEnd(10); int[] numbers = list.ToArray(); Assert.AreEqual(10, numbers[0]); }
public void InsertAtEnd_EmptySingleLinkedList_HasOneValue() { SingleLinkedList <int> list = new SingleLinkedList <int>(); list.InsertAtEnd(10); int[] numbers = list.ToArray(); Assert.AreEqual(1, numbers.Length); }
public void Iterate_SingleLinkedList_InProperOrder() { SingleLinkedList <int> list = new SingleLinkedList <int>(); list.InsertFront(1); list.InsertFront(2); list.InsertFront(3); int[] numbers = list.ToArray(); Assert.AreEqual(new int[] { 3, 2, 1 }, numbers); }
public void IterateAfterInsertAtEnd_SingleLinkedList_InProperOrder() { SingleLinkedList <int> list = new SingleLinkedList <int>(); list.InsertAtEnd(1); list.InsertAtEnd(2); list.InsertAtEnd(3); int[] numbers = list.ToArray(); Assert.AreEqual(new int[] { 1, 2, 3 }, numbers); }
public void Delete4_123_Returns123() { SingleLinkedList <int> list = new SingleLinkedList <int>(); list.InsertAtEnd(1); list.InsertAtEnd(2); list.InsertAtEnd(3); list.Delete(4); int[] numbers = list.ToArray(); Assert.AreEqual(new int[] { 1, 2, 3 }, numbers); }
public void Clone_123_Equals123() { SingleLinkedList <int> list = new SingleLinkedList <int>(); list.InsertAtEnd(1); list.InsertAtEnd(2); list.InsertAtEnd(3); var copy = list.Clone(); int[] numbers = list.ToArray(); int[] copyNumbers = copy.ToArray(); Assert.AreEqual(numbers, copyNumbers); }