public void AddManyStudentToClassByFunction2Test() { List <Student> students = new List <Student>(); Classes classes = new Classes(1, students, "Klasa 1"); classes.AddStudentToClass(1, "Student 1"); classes.AddStudentToClass(2, "Student 2"); classes.AddStudentToClass(3, "Student 3"); Assert.AreEqual(classes.students.ElementAt(0).Name, "Student 1"); Assert.AreEqual(classes.students.ElementAt(0).StudentId, 1); Assert.AreEqual(classes.students.ElementAt(1).Name, "Student 2"); Assert.AreEqual(classes.students.ElementAt(1).StudentId, 2); Assert.AreEqual(classes.students.ElementAt(2).Name, "Student 3"); Assert.AreEqual(classes.students.ElementAt(2).StudentId, 3); }
public void AddDuplicateStudentToClassByFunctionTest() { Student student1 = new Student(1, "Student 1"); Student student2 = new Student(1, "Student 1"); Student student3 = new Student(3, "Student 3"); List <Student> students = new List <Student>(); Classes classes = new Classes(1, students, "Klasa 1"); Assert.IsTrue(classes.AddStudentToClass(student1)); Assert.IsFalse(classes.AddStudentToClass(student2)); Assert.IsTrue(classes.AddStudentToClass(student3)); Assert.AreEqual(classes.students.ElementAt(0).Name, "Student 1"); Assert.AreEqual(classes.students.ElementAt(0).StudentId, 1); Assert.AreEqual(classes.students.ElementAt(1).Name, "Student 3"); Assert.AreEqual(classes.students.ElementAt(1).StudentId, 3); }