public void Concrete_AddThree_GetFirst() { StringLinkedList linkedList = new StringLinkedList(); linkedList.Add("1"); linkedList.Add("2"); linkedList.Add("3"); Assert.AreEqual("1", linkedList.First().Value); }
public void Concrete_AddFive_GetLast() { StringLinkedList linkedList = new StringLinkedList(); linkedList.Add("1"); linkedList.Add("2"); linkedList.Add("3"); linkedList.Add("4"); linkedList.Add("5"); Assert.AreEqual("5", linkedList.ElementAt(4).Value); }
public void Concrete_AddThree_TraverseThree() { StringLinkedList linkedList = new StringLinkedList(); linkedList.Add("1"); linkedList.Add("2"); linkedList.Add("3"); Assert.AreEqual("3", linkedList.Head.Value); Assert.AreEqual("2", linkedList.Head.Next.Value); Assert.AreEqual("1", linkedList.Head.Next.Next.Value); }
public void Concrete_AddFive_InsertBetween_3And4() { StringLinkedList linkedList = new StringLinkedList(); linkedList.Add("1"); linkedList.Add("2"); linkedList.Add("3"); linkedList.Add("4"); linkedList.Add("5"); linkedList.Insert("x", 3); Assert.AreEqual("1", linkedList.ElementAt(0).Value); Assert.AreEqual("2", linkedList.ElementAt(1).Value); Assert.AreEqual("3", linkedList.ElementAt(2).Value); Assert.AreEqual("x", linkedList.ElementAt(3).Value); Assert.AreEqual("4", linkedList.ElementAt(4).Value); Assert.AreEqual("5", linkedList.ElementAt(5).Value); }
public void Concrete_AddNone_GetFirst_ReturnsNull() { StringLinkedList linkedList = new StringLinkedList(); Assert.IsNull(linkedList.First()); }
public void Concrete_AddOne_Insert() { StringLinkedList linkedList = new StringLinkedList(); linkedList.Add("1"); linkedList.Insert("x", 0); Assert.AreEqual("x", linkedList.ElementAt(0).Value); Assert.AreEqual("1", linkedList.ElementAt(1).Value); }