Beispiel #1
0
 public void TestRemoveStudentByUniqueNumberThatDoesNotExist()
 {
     Course it = new Course("IT");
     Student Ivan = new Student("ivan", 34517);
     it.AddStudent(Ivan);
     it.RemoveStudentByUniqueNumber(999999);
 }
Beispiel #2
0
 public void TestAddStudentToCourse()
 {
     Course it = new Course("IT");
     Student Ivan = new Student("ivan", 34587);
     it.AddStudent(Ivan);
     Assert.AreEqual(it.students.Count, 1);
 }
Beispiel #3
0
 public void TestRemoveStudentByUniqueNumber()
 {
     Course it = new Course("IT");
     Student Ivan = new Student("ivan", 34597);
     it.AddStudent(Ivan);
     it.RemoveStudentByUniqueNumber(34597);
 }
Beispiel #4
0
 public void AddCourse(Course course)
 {
     if (this.CheckifCourseExists(course))
     {
         throw new ArgumentException("The course already exists!");
     }
     this.courses.Add(course);
 }
Beispiel #5
0
 public void RemoveCourse(Course course)
 {
     if (this.courses.Count == 0)
     {
         throw new ArgumentOutOfRangeException("No courses available in the school yet!");
     }
     this.courses.Remove(course);
 }
Beispiel #6
0
 public void TestRemoveStudentt()
 {
     List<Student> students = new List<Student>();
     Course course = new Course(students);
     Student student = new Student("Mitko Mitev", 61614);                       
     course.AddStudents(student);
     course.Remove(student);
     Assert.IsTrue(course.Participants.Count == 0);
 }
Beispiel #7
0
 public void TestAddStudentToFullCourse()
 {
     Course it = new Course("IT");
     for (int i = 50000; i < 50032; i++)
     {
         Student Ivan = new Student("Ivan", i);
         it.AddStudent(Ivan);
     }
 }
Beispiel #8
0
        private bool CheckifCourseExists(Course course)
        {
            if (courses.Contains(course))
            {
                return true;
            }

            return false;
        }
Beispiel #9
0
 public void TestCourseAddStudent()
 {         
     List<Student> students = new List<Student>();
     Course course = new Course(students);                      
    Student student = new Student("Mitko Mitev", 61614);           
    //Course course = new Course();
    course.AddStudents(student);
    Assert.IsTrue(course.Participants.Contains(student));
 }
Beispiel #10
0
 public void TestCourseAddStudents()
 {
     List<Student> students = new List<Student>();
     Course course = new Course(students);
     Student student = new Student("Mitko Mitev", 61614);
     Student student1 = new Student("Krali Marko", 23237);
     course.AddStudents(student1);
     course.AddStudents(student);
     Assert.IsTrue(course.Participants.Count==2);
 }
Beispiel #11
0
 public void TestCourseAddStudentTwise()
 {
     List<Student> students = new List<Student>();
     Course course = new Course(students);
     Student student = new Student("Mitko Mitev", 61614);
     Student student1 = new Student("Mitko Mitev", 61614);
     course.AddStudents(student1);
     course.AddStudents(student);
     
 }
Beispiel #12
0
        public void TestCourseAddRemoveStudent()
        {
            Course course = new Course();
            Student student = new Student("Pesho", 50000);

            for (int i = 0; i < 30; i++)
            {
                course.AddStudent(student);
            }

            course.RemoveStudent(student);
        }
Beispiel #13
0
        public void RemoveStudent(Course course, Student student)
        {
            if (!this.courses.Contains(course))
            {
                throw new ArgumentException("No such course in school");
            }

            var schoolCourse = this.courses.Find((x) => x == course);

            if (!schoolCourse.Students.Remove(student))
            {
                throw new ArgumentException("No such student in course");
            }
        }
Beispiel #14
0
        public static void Main()
        {
            var st = new Student("dada", 33424);
            var st1 = new Student("d22ada", 31424);

            var languageSchool = new School();
            languageSchool.AddStudent(st);
            languageSchool.AddStudent(st1);

            var math = new Course();
            math.AddStudent(st);
            math.AddStudent(st1);
            math.RemoveStudent(new Student("dddd", 23232));
            languageSchool.AddCourse(math);
            languageSchool.RemoveCourse(math);
            languageSchool.AddCourse(math);
        }
Beispiel #15
0
        public void AddStudent(Course course, Student student)
        {
            if (!this.courses.Contains(course))
            {
                throw new ArgumentException("No such course in school");
            }

            for (int i = 0; i < this.courses.Count; i++)
            {
                var currentCourse = this.courses[i];
                for (int j = 0; j < currentCourse.Students.Count; j++)
                {
                    if (student.Id == currentCourse.Students[j].Id)
                    {
                        throw new ArgumentException("There is already a student with the same id in the school");
                    }
                }
            }

            this.courses.Find((x) => x == course).Students.Add(student);

        }
Beispiel #16
0
 public bool RemoveCourse(Course course)
 {
     return this.courses.Remove(course);
 }
Beispiel #17
0
 public void TestAddMoreThanExpected()
 {
     List<Student> students = new List<Student>();
     Course course = new Course(students);
     Student student = new Student("Mitko Mitev", 61614);
     for (int i = 10001; i < 10032; i++)
     {
         course.AddStudents(new Student("Marto",i));
     }                        
     
 }
Beispiel #18
0
 public void TestCourseName()
 {
     string name = "Jhonathan";
     Course course = new Course(name);
     Assert.AreEqual(course.Name, name);           
 }
Beispiel #19
0
 public void TestFindStudent()
 {
     List<Student> students = new List<Student>();
     Course course = new Course(students);           
     Student student = new Student("Mitko Mitev", 61614);
     course.AddStudents(student);
     bool actual = course.IsStudentFound(student);         
     Assert.AreEqual(true,actual);
 }
Beispiel #20
0
 public void AddCourse(Course course)
 {
     this.courses.Add(course);
 }