public void AddStudentTestExistingStudent()
 {
     Course course = new Course("QualityCode");
     Student petar = new Student("Petar Petrov", 12345);
     course.AddStudent(petar);
     course.AddStudent(petar);
 }
 public void AddStudentTestTwoStudents()
 {
     Course course = new Course("QualityCode");
     course.AddStudent(new Student("Petar Petrov", 12345));
     course.AddStudent(new Student("Todor Todorov", 54321));
     Assert.IsTrue(course.Students.Count == 2);
 }
 public void CourseConstructorTestListStudents()
 {
     Course course = new Course("QualityCode");
     Student petar = new Student("Petar Petrov", 12345);
     course.AddStudent(petar);
     Assert.IsTrue(course.Students.Contains(petar));
 }
 public void AddCourseTest()
 {
     Course course = new Course("QualityCode");
     School school = new School();
     school.AddCourse(course);
     Assert.AreEqual(course.Name, school.Courses[0].Name);
 }
Exemple #5
0
 public void CourseRemoveStudentWhenTheListIsEmpty()
 {
     Course course = new Course("C#", new List<Student>());
     Student student = new Student("Svetlin", 11111);
     course.RemoveStudent(student);
     Assert.AreEqual(0, course.Students.Count);
 }
Exemple #6
0
 public void SchoolAddCourseToSchoolRegularTest()
 {
     School school = new School(new List<Student>(), new List<Course>());
     Course course = new Course("C#", new List<Student>());
     school.AddCourse(course);
     Assert.AreEqual(1, school.AllCourses.Count);
 }
 public void RemoveCourseTest()
 {
     School school = new School();
     Course course = new Course("QualityCode");
     school.AddCourse(course);
     school.RemoveCourse(course);
     Assert.IsTrue(school.Courses.Count == 0);
 }
Exemple #8
0
 public void CourseRemoveStudentRegularTest()
 {
     Course course = new Course("C#", new List<Student>());
     Student student = new Student("Svetlin", 11111);
     course.AddStudent(student);
     course.RemoveStudent(student);
     Assert.AreEqual(0, course.Students.Count);
 }
 public void AddStudentTestMoreThanMaximumStudents()
 {
     Course course = new Course("QualityCode");
     for (int i = 0; i < 31; i++)
     {
         course.AddStudent(new Student("Petar Petrov " + i, 10000 + i));
     }
 }
Exemple #10
0
 public void CourseAddStudentWhenTheCourseIsFullTest()
 {
     Course course = new Course("C#", new List<Student>());
     for (int i = 0; i < 40; i++)
     {
         Student student = new Student("Svetlin" + i, 11100 + i);
         course.AddStudent(student);
     }
 }
Exemple #11
0
 public void CourseAddStudentAlreadyInTheCourseTest()
 {
     Course course = new Course("C#", new List<Student>());
     Student student = new Student("Svetlin", 11111);
     Student student1 = new Student("Svetlin", 11111);
     course.AddStudent(student);
     course.AddStudent(student1);
     Assert.AreEqual(1,course.Students.Count);
 }
        public void RemoveCourse(Course course)
        {
            if (!this.Courses.Contains(course))
            {
                throw new ArgumentException("The course does not exist in this school!");
            }

            this.Courses.Remove(course);
        }
        public void AddCourse(Course course)
        {
            if (this.Courses.Contains(course))
            {
                throw new ArgumentException("The course exists already!");
            }

            this.Courses.Add(course);
        }
Exemple #14
0
        public void StudentJoinCourseRegularTest()
        {
            Course course = new Course("C#", new List<Student>());
            Student student = new Student("Svetlin", 11111);

            student.JoinCourse(course);

            Assert.AreEqual(1, course.Students.Count);
        }
Exemple #15
0
 public void SchoolAddCertainCourseWhoExistsAlreadyTest()
 {
     School school = new School(new List<Student>(), new List<Course>());
     Course course = new Course("C#", new List<Student>());
     Course course1 = new Course("C#", new List<Student>());
     school.AddCourse(course);
     school.AddCourse(course1);
     Assert.AreEqual(1, school.AllCourses.Count);
 }
Exemple #16
0
 public void AddCourse(Course course)
 {
     int index = this.allCourses.FindIndex(cour => cour.Name.Equals(course.Name));
     if (index == -1)
     {
         this.allCourses.Add(course);
     }
     else
     {
         throw new ArgumentException("Course with name" + course.Name+"already exists", "course");
     }
 }
 public void RemoveStudentTest()
 {
     Course course = new Course("QualityCode");
     course.AddStudent(new Student("Petar Petrov", 12345));
     Student todor = new Student("Todor Todorov", 54321);
     course.AddStudent(todor);
     course.RemoveStudent(todor);
     Assert.IsTrue(course.Students.Count == 1);
 }
 public void RemoveNonExistingStudentTest()
 {
     Course course = new Course("QualityCode");
     Student petar = new Student("Petar Petrov", 12345);
     course.RemoveStudent(petar);
 }
 public void NameTestNullValue()
 {
     Course course = new Course(null);
 }
 public void NameTestEmptyString()
 {
     Course course = new Course(string.Empty);
 }
 public void CourseConstructorTestName()
 {
     Course course = new Course("QualityCode");
     Assert.AreEqual(course.Name, "QualityCode");
 }
Exemple #22
0
 public void CourseStudentsPropertyRegularTest()
 {
     List<Student> students = new List<Student>();
     Student student = new Student("Svetlin", 11111);
     students.Add(student);
     Course course = new Course("C#", students);
 }
 public void AddStudentTestOneStudent()
 {
     Course course = new Course("QualityCode");
     course.AddStudent(new Student("Petar Petrov", 12345));
     Assert.IsTrue(course.Students.Count == 1);
 }
Exemple #24
0
 public void CourseNameRegularTest()
 {
     Course course = new Course("C#", new List<Student>());
     Assert.AreEqual("C#", course.Name);
 }
Exemple #25
0
 public void CourseStudentsPropertyNullTest()
 {
     Course course = new Course("C#", null);
 }
Exemple #26
0
 public void CourseStudentsPropertyMoreThan30Test()
 {
     List<Student> students = new List<Student>();
     for (int i = 0; i < 40; i++)
     {
         Student student = new Student("Svetlin"+i, 11100+i);
         students.Add(student);
     }
     Course course = new Course("C#", students);
 }
 public void ToStringTestTwoStudents()
 {
     Course course = new Course("QualityCode");
     course.AddStudent(new Student("Petar Petrov", 12345));
     course.AddStudent(new Student("Todor Todorov", 54321));
     string expected = "Course name QualityCode; Student Petar Petrov, ID 12345; Student Todor Todorov, ID 54321; ";
     string result = course.ToString();
     Assert.AreEqual(expected, result);
 }
Exemple #28
0
 public void CourseNameEmptyStringTest()
 {
     Course course = new Course("", new List<Student>());
 }
Exemple #29
0
 public void RemoveCourse(Course course)
 {
     this.AllCourses.Remove(course);
 }
Exemple #30
0
 public void LeaveCourse(Course course)
 {
     course.RemoveStudent(this);
 }