Beispiel #1
0
 public void TestRemoveStudentByUniqueNumber()
 {
     Course it = new Course("IT");
     Student Ivan = new Student("ivan", 34597);
     it.AddStudent(Ivan);
     it.RemoveStudentByUniqueNumber(34597);
 }
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 TestRemoveStudentByUniqueNumberThatDoesNotExist()
 {
     Course it = new Course("IT");
     Student Ivan = new Student("ivan", 34517);
     it.AddStudent(Ivan);
     it.RemoveStudentByUniqueNumber(999999);
 }
Beispiel #4
0
 public void TestStudentID()
 {
     //string name = "Mitaka";
     int number = 65516;
     Student student = new Student(number);
     Assert.AreEqual(student.CourseNumber, number);
 }
Beispiel #5
0
 public void TestCourseStudentAdd()
 {
     Student student = new Student("Mitko Mitev",61614);
     List<Student> list = new List<Student>();
     list.Add(student);
     Assert.IsTrue(list.Contains(student));
 }
Beispiel #6
0
 public void TestStudentName()
 {
     string name = "Mitaka";
     //int number = 65565;
     Student student = new Student(name);
     Assert.AreEqual(student.Name, name);
 }
Beispiel #7
0
 public void AddStudent(Student student)
 {
     if (this.CheckifStudentExists(student.UniqueNumber))
     {
         throw new ArgumentException(string.Format("Student with ID | {0} | already exists!", student.UniqueNumber));
     }
     this.studentsInSchool.Add(student);
 }
Beispiel #8
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 #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 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 #11
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 #12
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 #13
0
 public void AddStudent(Student student)
 {
     if (students.Count <= 30)
     {
         students.Add(student);
     }
     else
     {
         throw new ArgumentOutOfRangeException("This course is full!");
     }
 }
Beispiel #14
0
 public static void AddStudent(Student student)
 {
     for (int i = 0; i < Students.Count; i++)
     {
         if (Students[i].UniqueNumber == student.UniqueNumber)
         {
             throw new ArgumentException("There is student with the same unique number!");
         }
     }
     Students.Add(student);
 }
Beispiel #15
0
 public void AddStudent(Student student)
 {
     if (this.CheckNumberOfStudents(this.students.Count))
     {
         this.students.Add(student);
     }
     else
     {
         throw new ArgumentOutOfRangeException("Number of students in the course can't be more than 29!");
     }
 }
Beispiel #16
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 #17
0
 public void RemoveStudent(Student student)
 {
     //Remove student that doesn't exists
     if (this.students.Count != 0)
     {
         this.students.Remove(student);
     }
     else
     {
         throw new ArgumentOutOfRangeException("In the course there are no students yet!");
     }
 }
Beispiel #18
0
        public void Remove(Student student)
        {
            bool found = this.IsStudentFound(student);

            if (!found)
            {
                throw new ArgumentException("There is not such a student");                
            }
            else
            {
                Participants.Remove(student);
            }
        }
Beispiel #19
0
 public bool IsStudentFound(Student student)
 {
     bool found = false;
     for (int i = 0; i < Participants.Count; i++)
     {
         if (this.Participants[i].CourseNumber == student.CourseNumber)
         {
             found = true;
         }
        
     }
     return found;
 }
Beispiel #20
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 #21
0
 public void AddStudents(Student student)
 {
     bool found = this.IsStudentFound(student);
     if(found)
     {
         throw new ArgumentException("This student is already in the course");
     }
     else if (Participants.Count < MAX_STUDENTS_CLASS)
     {
         this.Participants.Add(student);
     }
     else
     {
         throw new ArgumentOutOfRangeException("There are not more free positions for the course ");
     }
 }
Beispiel #22
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 #23
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 #24
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 #25
0
 public void TestAddStudentWithSameUniqueNumber()
 {
     //The constructor of the class Student add new Student to School
     Student gosho = new Student("Gosho", 10001);
     Student tosho = new Student("Tosho Kato Gosho", 10001);
 }
Beispiel #26
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 #27
0
 public void TestUniqueNumberOutOfRange()
 {
     Student Teodor = new Student("teodor", 11111);
     Teodor.UniqueNumber = 11111111;
 }
Beispiel #28
0
 public void TestSetNameNull()
 {
     Student Teodor = new Student("teodor", 11111);
     Teodor.Name = null;
 }
Beispiel #29
0
 public void TestCreateStudent()
 {
     Student Ivan = new Student("ivan", 34567);
     Assert.AreEqual(Ivan.Name, "ivan");
     Assert.AreEqual(Ivan.UniqueNumber, 34567);
 }
Beispiel #30
0
 public void RemoveStudent(Student student)
 {
     this.studentsInSchool.Remove(student);
 }