public void AddStudent(Student student) { this.Students.Add(student); if (this.Students.Count > 30) { throw new ArgumentOutOfRangeException("Courses cannot contain more then 30 students"); } }
public void TestingStudentCreationWithValidId() { var name = "John"; var id = 50000; var student = new Student(name, id); Assert.AreEqual( id, student.Id, string.Format("The id of the student {0} does not match {1} ", student.Id, id)); }
public void TestingStudentCreationWithVaildName() { var name = "John"; var id = 50000; var student = new Student(name, id); Assert.AreEqual( name, student.Name, string.Format("The name of the student {0} does not match {1} ", student.Name, name)); }
public void TestingCourseAddingInvalidNumberOfStudents() { string name = "Tech class"; string studentName = "John"; int id = 10000; var student = new Student(studentName, id); var course = new Course(name); for (var i = 0; i < 32; i += 1) { course.AddStudent(student); } }
public void TestingCourseAddingStudents() { string name = "Tech class"; string studentName = "John"; int id = 10000; var student = new Student(studentName, id); var course = new Course(name); course.AddStudent(student); Assert.AreEqual( student, course.Students[0], string.Format("The object {0} does not equal the expected object {1}", course.Students[0], student)); }
public void TestingCourseRemovingStudents() { string name = "Tech class"; string studentName = "John"; int id = 10000; var student = new Student(studentName, id); var course = new Course(name); course.AddStudent(student); course.RemoveStudent(student); Assert.AreEqual( 0, course.Students.Count, string.Format("The length {0} does not equal the expected length {1}", course.Students.Count, 0)); }
public void TestingStudentCreationWithInvalidName() { string name = null; var id = 60000; var student = new Student(name, id); }
public void TestingStudentCreationWithInvalidId() { string name = "John"; int id = 1; var student = new Student(name, id); }
public void RemoveStudent(Student student) { this.Students.Remove(student); }