Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
            }
        }
Esempio n. 3
0
 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.");
 }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
 public void CourseName_ThrowException()
 {
     Course course = new Course("");
 }