public void JoinCourse(Course course) { if (course == null) { throw new ArgumentNullException("Course can't be null"); } course.AddStudent(this); }
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_AddStudentArgument() { Course testCourse = new Course(courseName, teacherName); Student studentGosho = new Student("Gosho"); testCourse.AddStudent(studentGosho); testCourse.AddStudent(studentGosho); }
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 TestCourse_RemoveStudentArgument() { Course testCourse = new Course(courseName, teacherName); Student gosho = new Student("Gosho"); Student pesho = new Student("Gosho"); testCourse.AddStudent(gosho); testCourse.RemoveStudent(pesho); }
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_AddStudentNullStudent() { Course testCourseNull = new Course(courseName, teacherName); testCourseNull.AddStudent(null); }
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); } }