Esempio n. 1
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);
 }
Esempio n. 2
0
        public void LeaveFromCourse(Course course)
        {
            course.RemoveStudent(this);

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

            course.RemoveStudent(this);
        }
Esempio n. 4
0
 public void UnsignCourse(Course course)
 {
     if (course == null)
     {
         throw new ArgumentNullException("Course cannot be null");
     }
     this.courses.Remove(course);
     if (course.listStudent.Contains(this))
     {
         course.RemoveStudent(this);
     }
 }
Esempio n. 5
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);
        }
 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");
 }
 public void TestCourseRemovingStudentWithNull()
 {
     Course course = new Course("JS");
     course.RemoveStudent(null);
 }
 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);
 }
Esempio n. 9
0
        public void LeaveFromCourse(Course course)
        {
            course.RemoveStudent(this);

            if (this.coursesThatStudentPraticipate.Contains(course))
            {
                this.coursesThatStudentPraticipate.Remove(course);
            }
        }
Esempio n. 10
0
 public void CourseShouldThrowExceptionWhenRemovingUnexistingStudent()
 {
     var course = new Course("HQC");
     var student = new Student("Daniel Popov", 10000);
     course.RemoveStudent(student);
 }
Esempio n. 11
0
 public void CourseShouldThrowExceptionWhenRemovingNullStudent()
 {
     var course = new Course("HQC");
     Student student = null;
     course.RemoveStudent(student);
 }