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 TestStudentConstructor_IdOutOfRange() { //The last student that is created in the loop have ID bigger than the maxID and the proprty throws an exception for (int i = Student.MinIdNumber; i < Student.MaxIdNumber; i++) { Student testStudentIdOutOfRange = new Student("Pesho"); } }
public void AddStudent(Student student) { if (student == null) { throw new ArgumentNullException("Student can't be null"); } if (this.students.Count == MaxStudentsInClass) { throw new InvalidOperationException("The number of students in one class must not exceed " + MaxStudentsInClass); } if (this.students.Contains(student)) { throw new ArgumentException("This student is already in the class"); } this.students.Add(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_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 RemoveStudent(Student student) { if (student == null) { throw new ArgumentNullException("Student can't be null"); } if (!this.students.Contains(student)) { throw new ArgumentException("There is no such student in the class."); } this.students.Remove(student); }
public void TestStudent_LeaveCourseNull() { Student testStudentOne = new Student("Pesho"); Course javascript = new Course("Javascript Course", "Nakov"); testStudentOne.JoinCourse(javascript); testStudentOne.LeaveCourse(null); }
public void TestStudentConstructor_BlankThrowException() { Student blankStudent = new Student(string.Empty); }
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 TestStudentConstructor_WhitespaceThrowException() { Student whitespaceStudent = new Student(" "); }
public void TestStudentConstructor_NullThrowException() { Student nullStudent = new Student(null); }
public void TestStudentConstructor_Name() { Student testStudent = new Student("Gosho Peshov"); Assert.AreEqual("Gosho Peshov", testStudent.Name, "Student name is not set in a correct way"); }
public void TestStudentConstructor_Id() { Student testStudentId = new Student("Pesho"); Assert.IsTrue((Student.MinIdNumber < testStudentId.Id && Student.MaxIdNumber > testStudentId.Id), "Id is not set in a correct way"); }
public void TestStudentConstructor_CompareId() { Student testStudentOne = new Student("Pesho"); Student testStudentTwo = new Student("Gosho"); Assert.IsTrue((testStudentOne.Id == (testStudentTwo.Id - 1)), "Id of the two students is not set in a correct way"); }
public void TestCourse_RemoveStudentArgumentNone() { Course testCourse = new Course(courseName, teacherName); Student gosho = new Student("Gosho"); testCourse.RemoveStudent(gosho); }
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 TestStudent_JoinCourseNull() { Student testStudentOne = new Student("Pesho"); testStudentOne.JoinCourse(null); }
public void TestCourse_AddStudentArgument() { Course testCourse = new Course(courseName, teacherName); Student studentGosho = new Student("Gosho"); testCourse.AddStudent(studentGosho); testCourse.AddStudent(studentGosho); }
public void TestStudent_ToString() { Student testStudentString = new Student("Pesho"); Assert.AreEqual(string.Format("Name: {0}, Id: {1}", testStudentString.Name, testStudentString.Id), testStudentString.ToString()); }