public void TestSchool_AddCourse()
 {
     School testSchool = new School(schoolName);
     Course javascript = new Course("Javascript", "Nakov");
     testSchool.AddCourse(javascript);
     Assert.IsTrue(testSchool.Courses.Contains(javascript), "Course is not in the school");
 }
 public void TestSchool_AddCourseArgument()
 {
     School testSchool = new School(schoolName);
     Course javascript = new Course("Javascript","Nakov");
     testSchool.AddCourse(javascript);
     testSchool.AddCourse(javascript);
 }
 public void TestStudent_JoinCourse()
 {
     Student testStudentOne = new Student("Pesho");
     Course javascript = new Course("Javascript Course", "Nakov");
     testStudentOne.JoinCourse(javascript);
     Assert.IsTrue(javascript.Students.Contains(testStudentOne), "Student has not been included in the course");
 }
 public void LeaveCourse(Course course)
 {
     if (course == null)
     {
         throw new ArgumentNullException("Course can't be null");
     }
     course.RemoveStudent(this);
 }
 public void JoinCourse(Course course)
 {
     if (course == null)
     {
         throw new ArgumentNullException("Course can't be null");
     }
     course.AddStudent(this);
 }
 public void AddCourse(Course course)
 {
     if (course == null)
     {
         throw new ArgumentNullException("Course can't be null");
     }
     if (this.courses.Contains(course))
     {
         throw new ArgumentException("This course is already listed in the school");
     }
     this.courses.Add(course);
 }
 public void RemoveCourse(Course course)
 {
     if (course == null)
     {
         throw new ArgumentNullException("Course can't be null");
     }
     if (!this.courses.Contains(course))
     {
         throw new ArgumentException("There is no such course in the school");
     }
     this.courses.Remove(course);
 }
 public void TestSchool_RemoveCourseArgument()
 {
     School testSchool = new School(schoolName);
     Course javascript = new Course("Javascript", "Nakov");
     Course oop = new Course("OOP", "Nakov");
     testSchool.AddCourse(javascript);
     testSchool.RemoveCourse(oop);
 }
 public void TestCourse_AddStudentInvalidOperation()
 {
     Course testCourseInvalid = new Course(courseName, teacherName);
     for (int i = 0; i < Course.MaxStudentsInClass + 1; i++)
     {
         Student student = new Student("Gosho");
         testCourseInvalid.AddStudent(student);
     }
 }
 public void TestCourse_RemoveStudent()
 {
     Course course = new Course(courseName, teacherName);
     Student pesho = new Student("Pesho");
     course.AddStudent(pesho);
     course.RemoveStudent(pesho);
     Assert.IsFalse(course.Students.Contains(pesho), "Student is still in the course");
 }
 public void TestCourse_AddStudentArgument()
 {
     Course testCourse = new Course(courseName, teacherName);
     Student studentGosho = new Student("Gosho");
     testCourse.AddStudent(studentGosho);
     testCourse.AddStudent(studentGosho);
 }
 public void TestCourse_AddStudent()
 {
     Course course = new Course(courseName, teacherName);
     Student pesho = new Student("Pesho");
     course.AddStudent(pesho);
     Assert.IsTrue(course.Students.Contains(pesho), "Student is not in the course");
 }
 public void TestCourse_RemoveStudentNullStudent()
 {
     Course testCourseNull = new Course(courseName, teacherName);
     testCourseNull.RemoveStudent(null);
 }
 public void TestStudent_LeaveCourseNull()
 {
     Student testStudentOne = new Student("Pesho");
     Course javascript = new Course("Javascript Course", "Nakov");
     testStudentOne.JoinCourse(javascript);
     testStudentOne.LeaveCourse(null);
 }
 public void TestCourseConstructor_NullThrowException()
 {
     Course nullCourse = new Course(null, null);
 }
 public void TestCourseConstructor_NullTeacherThrowException()
 {
     Course jsCourse = new Course(courseName, null);
 }
 public void TestCourseConstructor_NullNameThrowException()
 {
     Course nullCourse = new Course(null, teacherName);
 }
 public void TestCourseConstructor_BlankTeacherThrowException()
 {
     Course blankTeacherCourse = new Course(courseName, string.Empty);
 }
 public void TestCourseConstructor_BlankNameThrowException()
 {
     Course blankCourse = new Course(string.Empty, teacherName);
 }
 public void TesttCourse_ToString()
 {
     Course course = new Course(courseName, teacherName);
     Student pesho = new Student("Pesho");
     course.AddStudent(pesho);
     //Student StringBuilder
     StringBuilder studentStr = new StringBuilder();
     studentStr.AppendFormat("Name: Pesho, Id: {0}", pesho.Id).AppendLine();
     //Course StringBUilder
     StringBuilder message = new StringBuilder();
     message.AppendLine("------COURSE-INFO-------");
     message.AppendLine("Name = Javascript, Teacher = Nakov ");
     message.AppendFormat("Students: \n{0}", studentStr.ToString());
     message.AppendLine("------END-COURSE-INFO-------");
     Assert.AreEqual(message.ToString(), course.ToString(), "Strings don't match");
 }
 public void TestCourseConstructor_WhitespaceNameThrowException()
 {
     Course whitespaceCourse = new Course("   ", teacherName);
 }
 public void TestCourseConstructor_WhitespaceTeacherThrowException()
 {
     Course whitespaceTeacherCourse = new Course(courseName, "   ");
 }
 public void TestCourseConstructor_Teacher()
 {
     Course testCourse = new Course(courseName, teacherName);
     Assert.AreEqual(teacherName, testCourse.TeacherName, "Course with that teacher has not been created correctly");
 }
 public void TestCourse_RemoveStudentArgumentNone()
 {
     Course testCourse = new Course(courseName, teacherName);
     Student gosho = new Student("Gosho");
     testCourse.RemoveStudent(gosho);
 }