Пример #1
0
 public void TestJoinCourseSuccessfully()
 {
     Course course = new Course();
     Student student = new Student("Valia", 34567);
     string result = course.JoinCourse(student);
     Assert.AreEqual("Done!", result);
 }
Пример #2
0
        public void TestCourseWithZeroStudents()
        {
            List<Student> students = new List<Student>();

            Course newCourse = new Course(students);
            Assert.AreEqual(0, newCourse.StudentsInCourse.Count);
        }
Пример #3
0
 public void CourseShouldAddStudent()
 {
     var course = new Course("Maths");
     var student = new Student("unnamed", Student.MinValidId);
     student.JoinCourse(course);
     Assert.AreEqual(1, course.Students.Count);
 }
Пример #4
0
 public void AddingTheSameCourseMoreThanOnce_ThrowException()
 {
     var school = new SchoolDem("Filipovo");
     var course = new Course("Alg");
     school.AddCourse(course);
     school.AddCourse(course);
 }
Пример #5
0
 public void CourseShouldThrowIfStudentAlreadyAdded()
 {
     var course = new Course("Maths");
     var student = new Student("unnamed", Student.MinValidId);
     student.JoinCourse(course);
     student.JoinCourse(course);
 }
Пример #6
0
        public void TestRemoveNotExistingStudent()
        {
            Course css = new Course("CSS", students);
            Student koko = new Student("Kaloyan", 88823);

            css.RemoveStudent(koko);
        }
 public void AddStudentTwiseTest()
 {
     Course course = new Course("Math");
     Student student = new Student("Gosho", "Ivanov", 12345);
     course.AddStudent(student);
     course.AddStudent(student);
 }
Пример #8
0
        public void CourseCanNotRemoveAStudentThatItDoesntHave()
        {
            var course = new Course("math");
            var student = new Student("Pesho", 12345);

            course.RemoveStudent(student);
        }
Пример #9
0
 public void StudentGroupShouldAddCourse()
 {
     var myClass = new StudentGroup("TelerikAcad");
     var course = new Course("HQC");
     myClass.AddCourse(course);
     Assert.AreEqual(1, myClass.Courses.Count);
 }
Пример #10
0
 public void StudentShouldNotThrowWhenLeavingCourse()
 {
     var course = new Course("testCourse");
     var st = new Student("Pesho", 15000);
     st.JoinCourse(course);
     st.LeaveCourse(course);
 }
Пример #11
0
 public void NameTest()
 {
     string name = "JavaScript";
     Course target = new Course(name);
     string actual = target.Name;
     Assert.AreEqual(name, actual);
 }
Пример #12
0
 void ValidateCourse(Course course)
 {
     if (course == null)
     {
         throw new ArgumentNullException("This course is missed.");
     }
 }
Пример #13
0
 public void AddingTheSameStudentMoreThanOnce_ThrowException()
 {
     var spirt = new Course("Spirt");
     var student = new Student("Peter");
     spirt.AddStudent(student);
     spirt.AddStudent(student);
 }
Пример #14
0
 public void AddStudentAtsCourseMethodTest()
 {
     Course course = new Course("Math");
     Student student = new Student("Gosho", "Ivanov", 12345);
     course.AddStudent(student);
     Assert.AreEqual(student.ID, course.ListOfStudents[0].ID);
 }
Пример #15
0
 public void RemoveStudentInCourse()
 {
     Course course = new Course("lala");
     course.AddStudent(new Student("lol", 10000));
     course.RemoveStudentByUID(10000);
     course.AddStudent(new Student("lol", 10000));
 }
Пример #16
0
        public void TestAddCourse1()
        {
            School school = new School("Telerik");
            Course course = new Course("JavaScript");

            school.AddCourse(course);
            Assert.AreEqual(1, school.Courses.Count, "Course was not added successfully.");
        }
Пример #17
0
 public void TestMaxStudents()
 {
     Course c = new Course("Math");
     for (int i = 0; i <= 30; i++)
     {
         c.AddStudent(new Student("Johny", 20000 + i));
     }
 }
Пример #18
0
 public void CourseCanNotContain30OrMoreStudents()
 {
     var course = new Course("math");
     for (int i = 0; i < 30; i++)
     {
         course.AddStudent(new Student(i.ToString(), 10000 + i));
     }
 }
Пример #19
0
        public void CourseRemovingInvalidStudentShouldThrow()
        {
            var course = new Course("course");
            Student student = null;

            course.AddStudent(new Student("Captain Nemo", 12000));
            course.RemoveStudent(student);
        }
Пример #20
0
        public void CourseAddingAnAlreadyExistingStudentShouldThrow()
        {
            var course = new Course("Just a course");
            var student = new Student("Captain Nemo", 12000);

            course.AddStudent(student);
            course.AddStudent(student);
        }
Пример #21
0
 public void MoreThan30Students()
 {
     Course course = new Course("lala");
     for (int i = 0; i < 35; i++)
     {
         course.AddStudent(new Student(i.ToString(), 10000 + i));
     }
 }
Пример #22
0
        public void CourseRemovingAStudentWhoHasntEnrolledInTheCourseShouldThrow()
        {
            var course = new Course("course");
            var student = new Student("Captain Blackbeard", 10000);

            course.AddStudent(student);
            course.RemoveStudent(new Student("Captain Nemo", 12000));
        }
Пример #23
0
 public void RemoveCourse(Course courseToRemove)
 {
     if (courseToRemove == null)
     {
         throw new ArgumentNullException("You are trying to remove null value from courses list");
     }
     this.courses.Remove(courseToRemove);
 }
Пример #24
0
        public void CourseShouldAddStudentCorrectly()
        {
            var course = new Course("Intermediate Pirate Speech");
            var student = new Student("Captain Blackbeard", 55764);
            course.AddStudent(student);

            Assert.IsTrue(course.Students.Any(stud => stud.Name == student.Name && stud.Id == student.Id));
        }
Пример #25
0
 public void TestGetStudentsPropertyShouldReturnDifferentObjectEachCall()
 {
     var testCourse = new Course("testCourseName");
     var testStudent = new Student(10001, "Test Student Name");
     testCourse.InsertStudent(testStudent);
     Assert.AreNotSame(testCourse.Students, testCourse.Students,
         "Student list property returns same object, but should be copy.");
 }
Пример #26
0
        public void TestAddStudent3()
        {
            Course course = new Course("Telerik Academy");
            Student misho = new Student("Misho Ivanov");
            course.AddStudent(misho);

            Assert.AreEqual(1, course.ListOfStudents.Count, "Student was not added successfully.");
        }
Пример #27
0
 public void TestGetStudentsPropertyShouldReturnDeepCopyOfTheList()
 {
     var testCourse = new Course("testCourseName");
     var testStudent = new Student(10001, "Test Student Name");
     testCourse.InsertStudent(testStudent);
     Assert.AreNotSame(testCourse.Students[0], testCourse.Students[0],
         "Student list property returns same student as first member, but should be copy.");
 }
Пример #28
0
        public void CourseCanNotContainAStudentMoreThanOnce()
        {
            var course = new Course("math");
            var student = new Student("Pesho", 12345);

            course.AddStudent(student);
            course.AddStudent(student);
        }
Пример #29
0
 public void CourseOverflowTest()
 {
     var course = new Course("C# HQC");
     for (int i = 10100; i < 10135; i++)
     {
         course.AddStudent(new Student("Pesho", i));
     }
 }
Пример #30
0
        public void AddingCourseShouldIncreazeNumberOfCourses()
        {
            var school = new School();
            var course = new Course("pesho");
            school.AddCourse(course);

            Assert.AreEqual(1, school.CoursesCount, "Courses adding does not increaze count");
        }
Пример #31
0
 public bool JoinCourse(Course course)
 {
     course.AddStudent(this);
     return(true);
 }
Пример #32
0
 public bool LeaveCourse(Course course)
 {
     course.RemoveStudent(this);
     return(true);
 }