Пример #1
0
 public void AddCourse(Course course)
 {
     if (course == null)
     {
         throw new ArgumentNullException("You cannot have a course with a null value added to the school!");
     }
     this.courses.Add(course);
 }
Пример #2
0
        public void ExpectCourseToAddAStudent()
        {
            var course = new Course();
            var billy = new Student("Billy", 10000);
            course.AddStudent(billy);

            Assert.AreSame(billy, course.getStudents[0], "Expects the student inside the course to be the same");
        }
Пример #3
0
        public void ExpectCourseToRemoveStudent()
        {
            var course = new Course();
            var billy = new Student("Billy", 10000);
            course.AddStudent(billy);
            course.RemoveStudent(course.getStudents[0]);

            Assert.AreEqual(course.getStudents.Count, 0, "Expects the students list to be empty");
        }
Пример #4
0
 public void ExpectAddMethodToThrowWhenAddingMoreThan30Students()
 {
     var course = new Course();
     for (int i = 0; i <= 30; i++)
     {
         var billy = new Student("Billy" + i, 10000 + i);
         course.AddStudent(billy);
     }
 }
Пример #5
0
        public void ExpectAddCourseToAddTheCourse()
        {
            var school = new School();
            var course = new Course();
            var billy = new Student("Billy", 10000);
            course.AddStudent(billy);

            school.AddCourse(course);

            Assert.AreEqual(school.Courses[0], course, "Expected the school to have an added course");
        }
Пример #6
0
        public void ExpectRemoveCourseToRemoveTheCourse()
        {
            var school = new School();
            var course = new Course();
            var billy = new Student("Billy", 10000);
            course.AddStudent(billy);

            school.AddCourse(course);
            school.RemoveCourse(course);

            Assert.AreEqual(school.Courses.Count, 0, "Expected the school to have an empty course list");
        }
Пример #7
0
 public void RemoveCourse(Course course)
 {
     this.courses.Remove(course);
 }
Пример #8
0
 public void ExpectAddMethodToThrowWhenAddingNull()
 {
     var course = new Course();
     course.AddStudent(null);
 }