public void TestCourseExecuteStudentJoin()
        {
            Course myCourse = new Course("HTML");
            Student pesho = new Student("Pesho", 22222);
            Student ivan = new Student("Ivan", 33333);
            Student gosho = new Student("Gosho", 44444);

            myCourse.Join(pesho);
            myCourse.Join(ivan);
            myCourse.Join(gosho);

            Assert.IsTrue(myCourse.SetOfStudents.Count == 3);
        }
Beispiel #2
0
        public void Join(Student candidate)
        {
            if (this.IsStudentFound(candidate))
            {
                throw new CustomSchoolExeption("This student already joined the course!");
            }
            if (this.IsCourseFull())
            {
                throw new CustomSchoolExeption("This student can not join, because the course is already full!");
            }

            this.SetOfStudents.Add(candidate);
        }
        public void TestSchoolConstructorIsValid()
        {
            Course qA = new Course("QA");
            Course cSharp = new Course("CSharp");
            Course hTml = new Course("HTML");

            List<Course> myCourses = new List<Course>();
            myCourses.Add(qA);
            myCourses.Add(cSharp);
            myCourses.Add(hTml);

            Student pesho = new Student("Pesho", 22222);
            Student ivan = new Student("Ivan", 33333);
            Student gosho = new Student("Gosho", 44444);

            List<Student> myStudents = new List<Student>();
            myStudents.Add(pesho);
            myStudents.Add(ivan);
            myStudents.Add(gosho);

            School mySchool = new School("108 COY", myStudents, myCourses);

            Assert.IsNotNull(mySchool);
        }
 public void TestStudentNullName()
 {
     string name = string.Empty;
     int uniqueNumber = 12345;
     Student student = new Student(name, uniqueNumber);
 }
Beispiel #5
0
 //methods
 public void Leave(Student candidate)
 {
     if (this.IsStudentFound(candidate))
     {
         this.SetOfStudents.Remove(candidate);
     }
     else
     {
         throw new CustomSchoolExeption("This student is not in the course!");
     }
 }
Beispiel #6
0
        private bool IsStudentFound(Student candidate)
        {
            for (int i = 0; i < this.SetOfStudents.Count; i++)
            {
                if (candidate.StudentNumber == this.SetOfStudents[i].StudentNumber)
                {
                    return true;
                }
            }

            return false;
        }