public void TestGenericMixedInsertsAndRemoves() { MyLinkedList <ClubMember> list = new MyLinkedList <ClubMember>(); list.Insert(p3); // p3 list.Append(p22); // p3,p22 list.Insert(p9); // p9,p3,p22 list.Delete(0); // p3,p22 list.Insert(p1); // p1,p3,p22 list.Append(p24); // p1,p3,p22,p24 list.Insert(p5); // p5,p1,p3,p22,p24 list.Delete(4); // p5,p1,p3,p22 list.Append(p16); // p5,p1,p3,p22,p16 list.Delete(2); // p5,p1,p22,p16 Assert.AreEqual(p5, list.First); Assert.AreEqual(p16, list.Last); Assert.AreEqual(4, list.Count); Assert.AreEqual(p5, list.ItemAt(0)); Assert.AreEqual(p1, list.ItemAt(1)); Assert.AreEqual(p22, list.ItemAt(2)); Assert.AreEqual(p16, list.ItemAt(3)); Assert.AreEqual("5: Jarib Boustred (Male, 32 years)\n1: Farrand Semkins (Female, 77 years)\n22: Merle Bennet (Female, 42 years)\n16: Tore Saggs (Male, 28 years)\n", list.ToString()); }
public void TestDeleteAt() { MyLinkedList l1 = new MyLinkedList(); l1.Insert(c2); l1.Insert(c1); l1.Insert(c3, 1); l1.Insert(c4, 0); l1.Insert(c5, 4); l1.Delete(3); l1.Delete(3); Assert.AreEqual(3, l1.Count); Assert.AreEqual("4 Kurt Nielsen 33\n2 Bjørn Borg 30\n3 Cristian Nielsen 20\n", l1.ToString()); }
public void TestDelete() { MyLinkedList l1 = new MyLinkedList(); l1.Insert(c2); l1.Insert(c1); l1.Delete(); Assert.AreEqual(1, l1.Count); Assert.AreEqual("1 Anders And 15\n", l1.ToString()); }
public void TestGenericRemoves() { MyLinkedList <ClubMember> list = new MyLinkedList <ClubMember>(); list.Insert(p5); // p5 list.Insert(p21); // p21,p5 list.Insert(p9); // p9,p21,p5 list.Insert(p24); // p24,p9,p21,p5 list.Delete(2); // p24,p9,p5 Assert.AreEqual(p24, list.First); Assert.AreEqual(p5, list.Last); Assert.AreEqual(3, list.Count); Assert.AreEqual(p24, list.ItemAt(0)); Assert.AreEqual(p9, list.ItemAt(1)); Assert.AreEqual(p5, list.ItemAt(2)); }