示例#1
0
        public void AddExistingCourse()
        {
            University university = new University("first");
            Course     course     = new Course("second");

            university.AddCourse(course);
            university.AddCourse(course);

            Assert.AreEqual(university.Courses.Count, 1, "There have to be only one course.");
        }
        public void RemoveStudentFromEmptyCourse()
        {
            Course     course     = new Course("the course");
            University university = new University("the university");

            university.AddCourse(course);

            Student student = new Student("a", "b");

            course.RemoveStudent(student);

            Assert.AreEqual(course.StudentsList.Count, 0, "Thereare no students in the course.");
        }
        public void TryAddTwiceSameStudentInCourse()
        {
            Course     course     = new Course("the course");
            University university = new University("the university");

            university.AddCourse(course);

            Student student = new Student("a", "b");

            course.AddStudent(student);
            course.AddStudent(student);

            Assert.AreEqual(course.StudentsList.Count, 1, "Students in course is only one.");
        }
        public void TryAddMoreThan30StudentsInCourse()
        {
            Course     course     = new Course("the course");
            University university = new University("the university");

            university.AddCourse(course);

            for (int i = 0; i < 50; i++)
            {
                Student student = new Student("a", "b");
                course.AddStudent(student);
            }

            Assert.AreEqual(course.StudentsList.Count, 30, "Students in course cannot be more than 30");
        }