public void TestCourseAddSameStudentShouldThrow()
 {
     var course = new Course("C#");
     var student = new Student("Pesho", 10111);
     course.JoinCourse(student);
     course.JoinCourse(student);
 }
 public void TestSchoolAddSameCourseShouldThrow()
 {
     var course = new Course("C#");
     var school = new School("TA");
     school.AddCourse(course);
     school.AddCourse(course);
 }
 public void TestSchoolAddCorrectCourseShouldNotThrow()
 {
     var course = new Course("C#");
     var school = new School("TA");
     school.AddCourse(course);
     Assert.AreEqual(course, school.Courses[0]);
 }
 public void TestCourseAddCorrectStudentShouldNotThrow()
 {
     var course = new Course("C#");
     var student = new Student("Pesho", 10111);
     course.JoinCourse(student);
     Assert.AreEqual(student, course.Students[0]);
 }
示例#5
0
 public void RemoveCourse(Course courseToRemove)
 {
     if (courseToRemove == null)
     {
         throw new ArgumentNullException("You are trying to remove null value from courses list");
     }
     this.courses.Remove(courseToRemove);
 }
示例#6
0
        public void AddCourse(Course courseToAdd)
        {
            if (courseToAdd == null)
            {
                throw new ArgumentNullException("You are trying to add null as a course course list");
            }

            this.courses.Add(courseToAdd);
        }
        public void TestCourseRemoveExistantStudentShouldNotThrow()
        {
            var course = new Course("C#");
            var student = new Student("Pesho", 10111);
            course.JoinCourse(student);
            course.LeaveCourse(student);

            Assert.IsFalse(course.Students.Contains(student));
        }
        public void TestSchoolRemoveExistantCourseShouldNotThrow()
        {
            var course = new Course("C#");
            var school = new School("TA");
            school.AddCourse(course);
            school.RemoveCourse(course);

            Assert.IsFalse(school.Courses.Contains(course));
        }
        public void TestCourseAddMoreThanMaxStudentsShouldThrow()
        {
            var course = new Course("C#");

            for (int i = 0; i < 40; i++)
            {
                course.JoinCourse(new Student("Student" + i, 10000 + i));
            }
        }
示例#10
0
        public void RemoveCourse(Course course)
        {
            Validator.ObjectNotNullValidator(course, "Course");

            if (!this.Courses.Contains(course))
            {
                throw new InvalidOperationException("Course has not been added");
            }

            this.Courses.Remove(course);
        }
示例#11
0
        public void AddCourse(Course course)
        {
            Validator.ObjectNotNullValidator(course, "Course");

            if (this.Courses.Contains(course))
            {
                throw new InvalidOperationException("Course has already been added");
            }

            this.Courses.Add(course);
        }
 public void TestEmptyCourseNameShouldThrow()
 {
     var course = new Course(string.Empty);
 }
 public void TestCreateValidCourseShouldNotThrow()
 {
     var course = new Course("C#");
 }
 public void TestCourseRemoveNullStudentShouldThrow()
 {
     var course = new Course("C#");
     Student student = null;
     course.LeaveCourse(student);
 }
 public void TestCourseRemoveNotExistantStudentShouldThrow()
 {
     var course = new Course("C#");
     var student = new Student("Pesho", 10111);
     course.LeaveCourse(student);
 }
 public void TestCourseAddNullStudentShouldThrow()
 {
     var course = new Course("C#");
     Student student = null;
     course.JoinCourse(student);
 }
 public void TestNullCourseNameShouldThrow()
 {
     var course = new Course(null);
 }
 public void TestSchoolRemoveNotExistantCourseShouldThrow()
 {
     var course = new Course("C#");
     var school = new School("TA");
     school.RemoveCourse(course);
 }
 public void TestCourseHasExpectedName()
 {
     var course = new Course("C#");
     Assert.AreEqual("C#", course.Name);
 }