Ejemplo n.º 1
0
 public void TestRemoveStudentByUniqueNumberThatDoesNotExist()
 {
     Course it = new Course("IT");
     Student Ivan = new Student("ivan", 34517);
     it.AddStudent(Ivan);
     it.RemoveStudentByUniqueNumber(999999);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 3
0
 public void TestRemoveStudentByUniqueNumber()
 {
     Course it = new Course("IT");
     Student Ivan = new Student("ivan", 34597);
     it.AddStudent(Ivan);
     it.RemoveStudentByUniqueNumber(34597);
 }
Ejemplo n.º 4
0
 public void AddCourse(Course course)
 {
     if (this.CheckifCourseExists(course))
     {
         throw new ArgumentException("The course already exists!");
     }
     this.courses.Add(course);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 8
0
        private bool CheckifCourseExists(Course course)
        {
            if (courses.Contains(course))
            {
                return true;
            }

            return false;
        }
Ejemplo n.º 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));
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
     
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 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");
            }
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);

        }
Ejemplo n.º 16
0
 public bool RemoveCourse(Course course)
 {
     return this.courses.Remove(course);
 }
Ejemplo n.º 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));
     }                        
     
 }
Ejemplo n.º 18
0
 public void TestCourseName()
 {
     string name = "Jhonathan";
     Course course = new Course(name);
     Assert.AreEqual(course.Name, name);           
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 20
0
 public void AddCourse(Course course)
 {
     this.courses.Add(course);
 }