public void AddToTheEnd_NotEmptyList_Success() { SinglyLinkedList <int> list = new SinglyLinkedList <int>(); list.AddToTheEnd(10); list.AddToTheEnd(20); Assert.IsNotNull(list.Head.Next); Assert.AreEqual(20, list.Head.Next.Data); }
public void Find_ElementDoesNotExist_Success() { SinglyLinkedList <int> list = new SinglyLinkedList <int>(); list.AddToTheEnd(10); list.AddToTheEnd(20); list.AddToTheEnd(30); ListNode <int> result = list.FindElement(50); Assert.IsNull(result); }
public void Find_ElementIsLast_Success() { SinglyLinkedList <int> list = new SinglyLinkedList <int>(); list.AddToTheEnd(10); list.AddToTheEnd(20); list.AddToTheEnd(30); ListNode <int> result = list.FindElement(20); Assert.IsNotNull(result); Assert.AreEqual(20, result.Data); }
public void Delete_LastElement_Success() { SinglyLinkedList <int> list = new SinglyLinkedList <int>(); list.AddToTheEnd(10); list.AddToTheEnd(20); bool result = list.DeleteNode(20); Assert.IsTrue(result); Assert.IsNotNull(list.Head); Assert.IsNull(list.Head.Next); }