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

            Course newCourse = new Course(students);
            Assert.AreEqual(0, newCourse.StudentsInCourse.Count);
        }
Beispiel #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);
 }
Beispiel #4
0
 public void AddingTheSameCourseMoreThanOnce_ThrowException()
 {
     var school = new SchoolDem("Filipovo");
     var course = new Course("Alg");
     school.AddCourse(course);
     school.AddCourse(course);
 }
Beispiel #5
0
 public void CourseShouldThrowIfStudentAlreadyAdded()
 {
     var course = new Course("Maths");
     var student = new Student("unnamed", Student.MinValidId);
     student.JoinCourse(course);
     student.JoinCourse(course);
 }
        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);
 }
Beispiel #8
0
        public void CourseCanNotRemoveAStudentThatItDoesntHave()
        {
            var course = new Course("math");
            var student = new Student("Pesho", 12345);

            course.RemoveStudent(student);
        }
Beispiel #9
0
 public void StudentGroupShouldAddCourse()
 {
     var myClass = new StudentGroup("TelerikAcad");
     var course = new Course("HQC");
     myClass.AddCourse(course);
     Assert.AreEqual(1, myClass.Courses.Count);
 }
Beispiel #10
0
 public void StudentShouldNotThrowWhenLeavingCourse()
 {
     var course = new Course("testCourse");
     var st = new Student("Pesho", 15000);
     st.JoinCourse(course);
     st.LeaveCourse(course);
 }
 public void NameTest()
 {
     string name = "JavaScript";
     Course target = new Course(name);
     string actual = target.Name;
     Assert.AreEqual(name, actual);
 }
Beispiel #12
0
 void ValidateCourse(Course course)
 {
     if (course == null)
     {
         throw new ArgumentNullException("This course is missed.");
     }
 }
Beispiel #13
0
 public void AddingTheSameStudentMoreThanOnce_ThrowException()
 {
     var spirt = new Course("Spirt");
     var student = new Student("Peter");
     spirt.AddStudent(student);
     spirt.AddStudent(student);
 }
 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);
 }
 public void RemoveStudentInCourse()
 {
     Course course = new Course("lala");
     course.AddStudent(new Student("lol", 10000));
     course.RemoveStudentByUID(10000);
     course.AddStudent(new Student("lol", 10000));
 }
        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.");
        }
Beispiel #17
0
 public void TestMaxStudents()
 {
     Course c = new Course("Math");
     for (int i = 0; i <= 30; i++)
     {
         c.AddStudent(new Student("Johny", 20000 + i));
     }
 }
Beispiel #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));
     }
 }
Beispiel #19
0
        public void CourseRemovingInvalidStudentShouldThrow()
        {
            var course = new Course("course");
            Student student = null;

            course.AddStudent(new Student("Captain Nemo", 12000));
            course.RemoveStudent(student);
        }
Beispiel #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);
        }
 public void MoreThan30Students()
 {
     Course course = new Course("lala");
     for (int i = 0; i < 35; i++)
     {
         course.AddStudent(new Student(i.ToString(), 10000 + i));
     }
 }
Beispiel #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));
        }
 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);
 }
Beispiel #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));
        }
Beispiel #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.");
 }
        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.");
        }
Beispiel #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.");
 }
Beispiel #28
0
        public void CourseCanNotContainAStudentMoreThanOnce()
        {
            var course = new Course("math");
            var student = new Student("Pesho", 12345);

            course.AddStudent(student);
            course.AddStudent(student);
        }
Beispiel #29
0
 public void CourseOverflowTest()
 {
     var course = new Course("C# HQC");
     for (int i = 10100; i < 10135; i++)
     {
         course.AddStudent(new Student("Pesho", i));
     }
 }
Beispiel #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");
        }
Beispiel #31
0
 public bool JoinCourse(Course course)
 {
     course.AddStudent(this);
     return(true);
 }
Beispiel #32
0
 public bool LeaveCourse(Course course)
 {
     course.RemoveStudent(this);
     return(true);
 }