public void Ex14Test_WrongGradePoint() { List <Student> inputList = new List <Student>(); inputList.Add(new Student(0, "Jon", 10)); inputList.Add(new Student(1, "Timmy", 9)); inputList.Add(new Student(2, "Jack", 9)); inputList.Add(new Student(3, "Chance", 8)); int gradePoint = -1; List <Student> expectedResults = new List <Student>(); ExercisesPart1 exercises = new ExercisesPart1(); List <Student> actualResults = exercises.Ex14(inputList, gradePoint); int count; if (actualResults.Count > expectedResults.Count) { count = actualResults.Count; } else { count = expectedResults.Count; } for (int i = 0; i < count; i++) { Assert.AreEqual(actualResults[i].Id, expectedResults[i].Id); Assert.AreEqual(actualResults[i].Name, expectedResults[i].Name); Assert.AreEqual(actualResults[i].Points, expectedResults[i].Points); } }
public void Ex14Test_NoInputList() { List <Student> inputList = new List <Student>(); int gradePoint = 2; List <Student> expectedResults = new List <Student>(); ExercisesPart1 exercises = new ExercisesPart1(); List <Student> actualResults = exercises.Ex14(inputList, gradePoint); for (int i = 0; i < expectedResults.Count; i++) { Assert.AreEqual(actualResults[i].Id, expectedResults[i].Id); Assert.AreEqual(actualResults[i].Name, expectedResults[i].Name); Assert.AreEqual(actualResults[i].Points, expectedResults[i].Points); } }