public void CourseList_ThrowException_StudentAlreadyExists() { Course course = new Course("Math"); int uniqueID = 11111; Student student = new Student("Ivan", uniqueID); Student student2 = new Student("Georgi", uniqueID); course.AddStudent(student); course.AddStudent(student2); }
public void CourseList_ThrowException_MoreThan30Students() { Course course = new Course("Math"); Random uniqueID = new Random(); for (int i = 0; i < 50; i++) { Student student = new Student("Ivan", uniqueID.Next(10000, 99999)); course.AddStudent(student); } }
public void RemoveCourse(Course course) { for (int i = 0; i < CoursesInSchool.Count; i++) { if (CoursesInSchool[i].CourseName == course.CourseName) { coursesInSchool.Remove(course); Console.WriteLine("Course {0} removed.", course.CourseName); return; } } Console.WriteLine("Invalid remove operation. Course not found."); }
public void AddCourse(Course course) { for (int i = 0; i < CoursesInSchool.Count; i++) { if (CoursesInSchool[i].CourseName == course.CourseName) { throw new InvalidOperationException("There is already a course with the same name."); } } coursesInSchool.Add(course); Console.WriteLine("Course {0} added.", course.CourseName); }
public void CourseName_ThrowException() { Course course = new Course(""); }