public void TestCourseAddStudentMethodIfStudentIsPassedToBeAdded()
 {
     var student = new Student("aaa", 12345);
     var myCourse = new Course("aa");
     myCourse.AddStudent(student);
     Assert.AreEqual(student.ID, myCourse.Students[0].ID);
 }
 public void TestCourseRemoveStudentMethodIfInvalidStudentIsPassedToBeRemoved()
 {
     var validStudent = new Student("aaa", 12345);
     var invalidStudent = new Student("we", 12345);
     var myCourse = new Course("aa");
     myCourse.AddStudent(validStudent);
     myCourse.RemoveStudent(invalidStudent);
 }
 public void TestCourseRemoveStudentMethodIfValidStudentIsPassedToBeRemoved()
 {
     var student = new Student("aaa", 12345);
     var myCourse = new Course("aa");
     myCourse.AddStudent(student);
     myCourse.RemoveStudent(student);
     Assert.AreEqual(myCourse.Students.Count, 0);
 }
Example #4
0
        public void RemoveCourse(Course course)
        {
            if (course == null)
            {
                throw new ArgumentNullException("Course can not be null!");
            }

            this.courses.Remove(course);
        }
Example #5
0
        public void JointCourse(Course course)
        {
            if (course == null)
            {
                throw new ArgumentNullException("You must provide a course!");
            }

            course.AddStudent(this);
        }
Example #6
0
        public void MaxNumberStudentsInCourse()
        {
            School mySchool = new School();
            Course math = new Course();

            for (int i = 0; i < 31; i++)
            {
                math.AddStudent(new Student("Pesho", 10000 + i, mySchool));
            }
        }
 public void TestSchoolAddCourseMethodToAddCourses()
 {
     var myCourse = new Course("aa");
     var myAnotherCourse = new Course("aa");
     var mySchool = new School("zz");
     mySchool.AddCourse(myCourse);
     mySchool.AddCourse(myAnotherCourse);
     int courseCount = 2;
     Assert.AreEqual(courseCount, mySchool.Courses.Count);
 }
Example #8
0
        public void JoinCourse()
        {
            School mySchool = new School();

            Course math = new Course();

            Student pesho = new Student("Pesho", 10000, mySchool);

            pesho.JointCourse(math);

            Assert.IsTrue(math.Students.Count == 1);
        }
        public void TestCourseToHaveLessThan30Students()
        {
            var student = new Student("aaa", 12345);
            var myCourse = new Course("aa");
            for (int i = 0; i < 32; i++)
            {
                myCourse.AddStudent(student);
            }

            var expectedNumberOfStudentsInTheCourse = MaximalNumberOfStudentsInCourse;
            Assert.AreEqual(expectedNumberOfStudentsInTheCourse, myCourse.Students.Count);
        }
Example #10
0
        public void TryingToRemoveUnexistingStudent()
        {
            School mySchool = new School();
            Course math = new Course();

            for (int i = 0; i < 30; i++)
            {
                math.AddStudent(new Student("Pesho", 10000 + i, mySchool));
            }

            math.RemoveStudent(new Student("Gosho", 34322, mySchool));
        }
Example #11
0
        public void RemoveCourse()
        {
            School mySchool = new School();

            Course math = new Course();
            Course OOP = new Course();

            mySchool.AddCourse(math);
            mySchool.AddCourse(OOP);

            mySchool.RemoveCourse(math);

            Assert.IsTrue(mySchool.Courses.Count == 1);
        }
Example #12
0
        public void InitCourseWithList()
        {
            School mySchool = new School();

            List<Student> students = new List<Student>();

            for (int i = 0; i < 10; i++)
            {
                students.Add(new Student("pesho", 10000 + i, mySchool));
            }

            Course math = new Course(students);

            Assert.IsTrue(math.Students.Count == 10);
        }
Example #13
0
        public void LeaveCourse(Course course)
        {
            if (course == null)
            {
                throw new ArgumentNullException("You must provide a course!");
            }

            course.RemoveStudent(this);
        }
 public void AddCourse(Course course)
 {
     this.courses.Add(course);
 }
 public void TestCourseNameIfNullToThrowArgumentNullException()
 {
     Course myCourse = new Course(null);
 }
 public void TestCourseNameIfEqualToValidInput()
 {
     Course myCourse = new Course("abcd");
     var testCourseName = "abcd";
     Assert.AreEqual(testCourseName, myCourse.Name);
 }
 public void TestCourseNameIfEmptyStringToThrowArgumentException()
 {
     Course myCourse = new Course(string.Empty);
 }
Example #18
0
 public void InitCourseNull()
 {
     Course math = new Course(null);
 }
Example #19
0
 public void InitCourseWithNoList()
 {
     Course math = new Course();
     Assert.IsTrue(math.Students.Count == 0);
 }