public void TestCourseAddingNewStudentToShouldProperlyUpdateList()
 {
     Course course = new Course("financial");
     course.AddStudent(new Student("ivan1", 10001));
     course.AddStudent(new Student("ivan2", 10002));
     Assert.AreEqual(2, course.Students.Count, "List of students is icorrect");
 }
 public void TestCourseAddingStudentWithSameNameToThrow()
 {
     Course course = new Course("JS");
     Student asen = new Student("asen", 10000);
     course.AddStudent(asen);
     course.AddStudent(asen);
 }
示例#3
0
 public void CourseShouldThrowExceptionWhenExistingStudentIsAdded()
 {
     var course = new Course("High Quality Code");
     var student = new Student("Daniel Popov", 10000);
     course.AddStudent(student);
     course.AddStudent(student);
 }
示例#4
0
        public void CourseShouldAddStudentCorrectly()
        {
            var course = new Course("High Quality Code");
            var student = new Student("Daniel Popov", 10000);
            course.AddStudent(student);

            Assert.AreSame(student, course.Students.First());
        }
 public void TestCourseAddingMoreThan30StudentToThrow()
 {
     Course course = new Course("HQC");
     for (int i = 0; i <= 30; i++)
     {
         course.AddStudent(new Student("asen", 10000 + i));
     }
 }
示例#6
0
 public void CourseShouldThrowExceptionWhenMoreThanPossibleStudentsAdded()
 {
     var course = new Course("High Quality Code");
     for (int i = 0; i < 40; i++)
     {
         course.AddStudent(new Student(i.ToString(), 10000 + i));
     }
 }
示例#7
0
 public void CourseShoudRemoveStudentCorrectly()
 {
     var course = new Course("High Quality Code");
     var student = new Student("Daniel Popov", 10000);
     course.AddStudent(student);
     course.RemoveStudent(student);
     Assert.AreEqual(0, course.Students.Count);
 }
示例#8
0
        public void JoinCourse(Course course)
        {
            if (course == null)
            {
                throw new ArgumentNullException("Course cannot be null");
            }

            course.AddStudent(this);
        }
示例#9
0
        public void JointInCourse(Course course)
        {
            course.AddStudent(this);

            if (!this.coursesThatStudentPraticipate.Contains(course))
            {
                this.coursesThatStudentPraticipate.Add(course);
            }
        }
        public void AttendCourse(Course course)
        {
            if (course == null)
            {
                throw new ArgumentNullException("course", "Course cannot be null.");
            }

            course.AddStudent(this);
        }
 public void AddStudentsShouldAddTheStudent()
 {
     string name = "Petur Petrov";
     int uniqueNumber = 10002;
     Student student = new Student(name, uniqueNumber);
     List<Student> students = new List<Student>();
     Course newCourse = new Course(students,"Math");
     newCourse.AddStudent(student);
 }
示例#12
0
        public void TestOvreloadCourse()
        {
            Course normalCourse = new Course("C# OOP");
            string[] letters = new string[] { "s", "a", "e", "ela", "ina", "ka", "ona", };

            for (int i = 0; i < 60; i++)
            {
                normalCourse.AddStudent(new Student("Ivan" + letters[i % letters.Length], 10101 + i));
            }
        }
 public void RemoveStudentsShouldThrowErrorIfStudentDoesNotExist()
 {
     string name = "Petur Petrov";
     int uniqueNumber = 10002;
     Student student2 = new Student("Goshko", uniqueNumber + 1);
     Student student = new Student(name, uniqueNumber);
     List<Student> students = new List<Student>();
     Course newCourse = new Course(students, "Math");
     newCourse.AddStudent(student);
     newCourse.RemoveStudents(student2);
 }
 public void AddStudentsShouldThrowErrorIfStudentsAreMoreThanMaxStudents()
 {
     List<Student> students = new List<Student>();
     Course newCourse = new Course(students,"English");
     for (int i = 0; i <35 ; i++)
     {
         Student student = new Student("Petur Iordanov", (10001+i));
         newCourse.AddStudent(student);  
     }
   
 }
示例#15
0
        public void TestAddingStudents()
        {
            Course normalCourse = new Course("C# OOP");
            string[] letters = new string[] { "s", "a", "e", "ela", "ina", "ka", "ona", };

            for (int i = 0; i < 30; i++)
            {
                normalCourse.AddStudent(new Student("Ivan" + letters[i % letters.Length], 10101 + i));
            }

            Assert.AreEqual(30, normalCourse.Participants.Count);
        }
示例#16
0
 public void SignCourse(Course course)
 {
     if (course == null)
     {
         throw new ArgumentNullException("Course can not be null!");
     }
     this.courses.Add(course);
     if (!courses.Contains(course))
     {
         course.AddStudent(this);
     }
 }
示例#17
0
        public void TestAddRemoveStudents()
        {
            Course normalCourse = new Course("C# OOP");
            string[] letters = new string[] { "s", "a", "e", "ela", "ina", "ka", "ona", };
            Student[] participants = new Student[30];

            for (int i = 0; i < 30; i++)
            {
                participants[i] = new Student("Ivan" + letters[i % letters.Length], 10101 + i);
                normalCourse.AddStudent(participants[i]);
            }

            for (int i = 0; i < 30; i++)
            {
                normalCourse.RemoveStudent(participants[i]);
            }

            for (int i = 0; i < 5; i++)
            {
                normalCourse.AddStudent(new Student("Ivan" + letters[i % letters.Length], 20101 + i));
            }

            Assert.AreEqual(5, normalCourse.Participants.Count);
        }
示例#18
0
        public void TestCoursesAndStudents()
        {
            School academy = new School();
            string[] letters = new string[] { "s", "a", "e", "ela", "ina", "ka", "ona", };

            for (int i = 0; i < 5; i++)
            {
                Course pesho = new Course("Course #" + i);

                for (int j = 0; j < 30; j++)
                {
                    Student thisStudent = new Student("Ivan" + letters[i % letters.Length], (10344 * (i + 1)) + j);
                    pesho.AddStudent(thisStudent);
                    academy.AddStudentToSchool(thisStudent);
                }

                academy.AddCourseToSchool(pesho);
            }

            Assert.AreEqual(this.RetutnInfo(150, 5), academy.ShowInformationAboutSchool());
        }
 public void TestCourseRemovingStudentWithNonExistingNameToThrow()
 {
     Course course = new Course("JS");
     Student asen = new Student("asen", 10000);
     Student ivan = new Student("ivan", 10001);
     course.AddStudent(asen);
     course.RemoveStudent(ivan);
 }
 public void TestCourseRemovingStudentToBeValid()
 {
     Course course = new Course("financial");
     Student ivan1 = new Student("ivan1", 10001);
     Student ivan2 = new Student("ivan2", 10002);
     course.AddStudent(ivan1);
     course.AddStudent(ivan2);
     course.RemoveStudent(ivan1);
     Assert.IsTrue(course.Students.Contains(ivan2));
     Assert.AreEqual(1, course.Students.Count, "Incorrect student remove");
 }
示例#21
0
 public void CourseShouldThrowExceptionWhenNullStudentAdded()
 {
     var course = new Course("High Quality Code");
     Student student = null;
     course.AddStudent(student);
 }
 public void TestCourseAddingStudentWithNull()
 {
     Course course = new Course("JS");
     course.AddStudent(null);
 }
 public void TestCouresAddingStudentToBeValid()
 {
     Course course = new Course("info");
     course.AddStudent(new Student("asen", 20000));
 }
示例#24
0
        public void JointInCourse(Course course)
        {
            course.AddStudent(this);

            if (!this.coursesThatStudentPraticipate.Contains(course))
            {
                this.coursesThatStudentPraticipate.Add(course);
            }
        }