public void T12_Insert() { Pet pet1 = new Pet() { Age = 10 }; Pet pet2 = new Pet() { Age = 7 }; Pet pet3 = new Pet() { Age = 1 }; Pet pet4 = new Pet() { Age = 8 }; Pet pet5 = new Pet() { Age = 11 }; SortableArrayList list = new SortableArrayList(); list.Insert(0, pet1); Assert.AreEqual(pet1, list[0], "pet1 should be on first position"); list.Insert(1, pet2); Assert.AreEqual(pet2, list[1], "pet2 should be on second position"); list.Insert(1, pet3); Assert.AreEqual(pet1, list[0], "pet1 should be on first position"); Assert.AreEqual(pet3, list[1], "pet3 should be on second position"); Assert.AreEqual(pet2, list[2], "pet2 should be on third position"); }
public void T03_InsertItems_TestCount() { SortableArrayList list = new SortableArrayList(); list.Insert(0, "Item1"); Assert.AreEqual(1, list.Count(), "Count should return 1 after first insert"); list.Insert(0, "Item2"); Assert.AreEqual(2, list.Count(), "Count should return 2 after second insert"); list.Insert(1, "Item3"); Assert.AreEqual(3, list.Count(), "Count should return 3 after third insert"); }