public void SortByScoreAndName_SortsByScoreThenLastNameThenFullName() { //let's put in a good range so we check that it is sorting by score and full name and first name var grader = new Grader(); var p1 = new PersonAndScore("SMITH", "ALLAN", -5); var p2 = new PersonAndScore("SMITH", "LEO", 100); var p3 = new PersonAndScore("BUNDY", "TERESA", 89); var p4 = new PersonAndScore("KING", "MADISON", 89); var p5 = new PersonAndScore("BUNDY", "SOPHIA", 89); var p6 = new PersonAndScore("BUNDY", "SOPHIA", 83); grader.ScoreList.Add(p1); grader.ScoreList.Add(p2); grader.ScoreList.Add(p3); grader.ScoreList.Add(p4); grader.ScoreList.Add(p5); grader.ScoreList.Add(p6); grader.SortByScoreAndName(); //check that it has been sorted as expected: p2,p5,p3,p4,p6,p1 Assert.AreEqual(p2, grader.ScoreList[0]); Assert.AreEqual(p5, grader.ScoreList[1]); Assert.AreEqual(p3, grader.ScoreList[2]); Assert.AreEqual(p4, grader.ScoreList[3]); Assert.AreEqual(p6, grader.ScoreList[4]); Assert.AreEqual(p1, grader.ScoreList[5]); }
public void SortByScoreAndName_WithDuplicateInput_DoesntFail() { var grader = new Grader(); var p1 = new PersonAndScore("SMITH", "ALLAN", 83); var p2 = new PersonAndScore("SMITH", "ALLAN", 83); grader.ScoreList.Add(p1); grader.ScoreList.Add(p2); grader.SortByScoreAndName(); Assert.IsTrue(grader.ScoreList.Count == 2); }