public void SortObjectList() { //Arrange ListCustom <Person> testListOne = new ListCustom <Person>() { new Person("z"), new Person("x"), new Person("w"), new Person("a"), }; //Act testListOne.Sort(); //Arrange Assert.AreEqual("a", testListOne[0].name); Assert.AreEqual("w", testListOne[1].name); Assert.AreEqual("x", testListOne[2].name); Assert.AreEqual("z", testListOne[3].name); }
public void SortStringList() { //Arrange ListCustom <string> testListOne = new ListCustom <string>() { "v", "y", "x", "w", "z", "u", "t", "s", "r", "q" }; //Act testListOne.Sort(); //Assert Assert.AreEqual("q", testListOne[0]); Assert.AreEqual("r", testListOne[1]); Assert.AreEqual("s", testListOne[2]); Assert.AreEqual("t", testListOne[3]); Assert.AreEqual("u", testListOne[4]); Assert.AreEqual("v", testListOne[5]); Assert.AreEqual("w", testListOne[6]); Assert.AreEqual("x", testListOne[7]); Assert.AreEqual("y", testListOne[8]); Assert.AreEqual("z", testListOne[9]); }
public void SortIntList() { //Arrange ListCustom <int> testListOne = new ListCustom <int>() { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; //Act testListOne.Sort(); //Assert Assert.AreEqual(0, testListOne[0]); Assert.AreEqual(1, testListOne[1]); Assert.AreEqual(2, testListOne[2]); Assert.AreEqual(3, testListOne[3]); Assert.AreEqual(4, testListOne[4]); Assert.AreEqual(5, testListOne[5]); Assert.AreEqual(6, testListOne[6]); Assert.AreEqual(7, testListOne[7]); Assert.AreEqual(8, testListOne[8]); Assert.AreEqual(9, testListOne[9]); }