예제 #1
0
 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");
 }
예제 #2
0
 public void TestSchool_AddCourseArgument()
 {
     School testSchool = new School(schoolName);
     Course javascript = new Course("Javascript","Nakov");
     testSchool.AddCourse(javascript);
     testSchool.AddCourse(javascript);
 }
예제 #3
0
 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");
 }
예제 #4
0
 public void LeaveCourse(Course course)
 {
     if (course == null)
     {
         throw new ArgumentNullException("Course can't be null");
     }
     course.RemoveStudent(this);
 }
예제 #5
0
 public void JoinCourse(Course course)
 {
     if (course == null)
     {
         throw new ArgumentNullException("Course can't be null");
     }
     course.AddStudent(this);
 }
예제 #6
0
 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);
 }
예제 #7
0
 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);
 }
예제 #8
0
 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);
 }
예제 #9
0
 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);
     }
 }
예제 #10
0
 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");
 }
예제 #11
0
 public void TestCourse_AddStudentArgument()
 {
     Course testCourse = new Course(courseName, teacherName);
     Student studentGosho = new Student("Gosho");
     testCourse.AddStudent(studentGosho);
     testCourse.AddStudent(studentGosho);
 }
예제 #12
0
 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");
 }
예제 #13
0
 public void TestCourse_RemoveStudentNullStudent()
 {
     Course testCourseNull = new Course(courseName, teacherName);
     testCourseNull.RemoveStudent(null);
 }
예제 #14
0
 public void TestStudent_LeaveCourseNull()
 {
     Student testStudentOne = new Student("Pesho");
     Course javascript = new Course("Javascript Course", "Nakov");
     testStudentOne.JoinCourse(javascript);
     testStudentOne.LeaveCourse(null);
 }
예제 #15
0
 public void TestCourseConstructor_NullThrowException()
 {
     Course nullCourse = new Course(null, null);
 }
예제 #16
0
 public void TestCourseConstructor_NullTeacherThrowException()
 {
     Course jsCourse = new Course(courseName, null);
 }
예제 #17
0
 public void TestCourseConstructor_NullNameThrowException()
 {
     Course nullCourse = new Course(null, teacherName);
 }
예제 #18
0
 public void TestCourseConstructor_BlankTeacherThrowException()
 {
     Course blankTeacherCourse = new Course(courseName, string.Empty);
 }
예제 #19
0
 public void TestCourseConstructor_BlankNameThrowException()
 {
     Course blankCourse = new Course(string.Empty, teacherName);
 }
예제 #20
0
 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");
 }
예제 #21
0
 public void TestCourseConstructor_WhitespaceNameThrowException()
 {
     Course whitespaceCourse = new Course("   ", teacherName);
 }
예제 #22
0
 public void TestCourseConstructor_WhitespaceTeacherThrowException()
 {
     Course whitespaceTeacherCourse = new Course(courseName, "   ");
 }
예제 #23
0
 public void TestCourseConstructor_Teacher()
 {
     Course testCourse = new Course(courseName, teacherName);
     Assert.AreEqual(teacherName, testCourse.TeacherName, "Course with that teacher has not been created correctly");
 }
예제 #24
0
 public void TestCourse_RemoveStudentArgumentNone()
 {
     Course testCourse = new Course(courseName, teacherName);
     Student gosho = new Student("Gosho");
     testCourse.RemoveStudent(gosho);
 }