public void TestJoinCourseSuccessfully()
 {
     Course course = new Course();
     Student student = new Student("Valia", 34567);
     string result = course.JoinCourse(student);
     Assert.AreEqual("Done!", result);
 }
 public void TestCourseJoinCourse() 
 {
     Course course = new Course("Software Engineering");
     Student student = new Student("Nikolay Kostadinov", 10000);
     course.JoinCourse(student);
     bool isStudentInCourse = CheckForStudent(student, course);
     Assert.AreEqual(isStudentInCourse, true, "Invalid join");
 }
        public void TestJoinCourseMaximumStudentsSuccessfully()
        {
            Course course = new Course();
            int maxStudents = 29;

            for (int i = 0; i < maxStudents; i++)
            {
                course.JoinCourse(new Student("student"+i, 10002+i));
            }
        }
        public void TestJoinCourse31Students()
        {
            Course course = new Course();
            int maxStudents = 30;

            for (int i = 0; i < maxStudents; i++)
            {
                course.JoinCourse(new Student("student" + i, 20002 + i));
            }
        }
        public void TestJoinCourse15StudentsSuccessfully()
        {
            Course course = new Course();
            int joinStudents = 14;

            for (int i = 0; i < joinStudents; i++)
            {
                course.JoinCourse(new Student("student" + i, 30002 + i));
            }
        }
        public void TestAddingMoreThan30Students()
        {
            School.ListOfAllStudents.Clear();
            var course = new Course("hah");

            for (int i = 0; i < 32; i++)
            {
                course.JoinCourse(new Student("Lala", "Lala", 10001 + i));
            }
        }
        public void TestRemovingStudents()
        {
            School.ListOfAllStudents.Clear();
            var course = new Course("ALALLALALL");
            var student = new Student("LALA", "LALA", 10001);

            course.JoinCourse(student);
            course.LeaveCourse(student);

            Assert.AreEqual(0, course.ListOfStudents.Count);
        }
Beispiel #8
0
        /// <summary>
        /// Deep copy of Course object
        /// </summary>
        /// <returns>New Course object</returns>
        public object Clone()
        {
            Course cloneCourse = new Course(this.Name);
            foreach (var student in this.students) 
            {
                Student st = (Student)student.Value.Clone();
                cloneCourse.JoinCourse(st);
            }

            return cloneCourse;
        }
        public void TestListSuccessfull()
        {
            Course course = new Course();
            int joinStudents = 14;

            for (int i = 0; i < joinStudents; i++)
            {
                course.JoinCourse(new Student("student" + i, 38002 + i));
            }
            List<Student> students = new List<Student>(course.StudentsInCourse);
        }
        public void TestAddingStudents()
        {
            School.ListOfAllStudents.Clear();
            var course = new Course("Hard Rock Aleluya");

            for (int i = 0; i < 5; i++)
            {
                course.JoinCourse(new Student("Hamburg", "Ham", 10001 + i));
            }

            Assert.AreEqual(5, course.ListOfStudents.Count);
        }
        public void TestCourseJoinCourseMax()
        {
            const int StartStudentsID = 10000;
            const int MaxCourseCapacity = 30;
            const int LastStudentID = StartStudentsID + MaxCourseCapacity + 1;

            Course course = new Course("Software Engineering");

            for (uint id = StartStudentsID; id < LastStudentID; id++)
            {
                course.JoinCourse(new Student("Nikolay Kostadinov", id));
            }
        }
Beispiel #12
0
        /// <summary>
        /// Main Method
        /// </summary>
        public static void Main()
        {
            School tmt = new School("TMT");
            Course electricalEngeneering = new Course("Electrical Enceneering");
            for (int i = 0; i < 10; i++)
            {
                electricalEngeneering.JoinCourse(new Student(string.Format("Student{0}", i), tmt.GetStugentId));                    
            }

            tmt.AddCourse(electricalEngeneering);

            ConsolePrinter(tmt.ToString());
            foreach (var course in tmt.ViewCourses())
            {
                ConsolePrinter(course.ToString(), 3);
                foreach (var student in course.ViewStudents())
                {
                    ConsolePrinter(student.Value.ToString(), 6);
                }
            }
        }
        public void TestCourseFullClone()
        {
            const int StartStudentsID = 10000;
            const int MaxCourseCapacity = 30;
            const int LastStudentID = StartStudentsID + MaxCourseCapacity;

            Course course = new Course("Software Engineering");

            for (uint id = StartStudentsID; id < LastStudentID; id++)
            {
                course.JoinCourse(new Student("Nikolay Kostadinov", id));
            }

            course.LeaveCourse(new Student("Nikolay Kostadinov", 10029));

            Course cloneCourse = (Course)course.Clone();

            bool isEqual = CompareStudents(course, cloneCourse) && (course.Name == cloneCourse.Name);


            Assert.AreEqual(isEqual, true);
        }
        public void TestCourseLeaveCourse()
        {
            const int StartStudentsID = 10000;
            const int MaxCourseCapacity = 30;
            const int LastStudentID = StartStudentsID + MaxCourseCapacity;

            Course course = new Course("Software Engineering");

            for (uint id = StartStudentsID; id < LastStudentID; id++)
            {
                course.JoinCourse(new Student("Nikolay Kostadinov", id));
            }

            course.LeaveCourse(new Student("Nikolay Kostadinov", 10029));
            bool isStudentInCourse = CheckForStudent(new Student("Nikolay Kostadinov", 10029),course);

            Assert.AreEqual(isStudentInCourse, false, "Leave doesn't work correct");
        }
 public void TestCourseJoinCourseDublicatedStudent()
 {
     Course course = new Course("Software Engineering");
     course.JoinCourse(new Student("Nikolay Kostadinov", 10000));
     course.JoinCourse(new Student("Nikolay Kostadinov", 10000));
 }
 public void TestCourseJoinCourseEmpty()
 {
     Course course = new Course("Software Engineering");
     Student student = null;
     course.JoinCourse(student);
 }
 public void TestRemoveCourseSuccessfully()
 {
     Course course = new Course();
     Student student = new Student("Gosho", 34000);
     course.JoinCourse(student);
     string result = course.RemoveCourse(student);
     Assert.AreEqual("Done!", result);
 }
 public void TestCourseLeaveCourseNonExistStudent()
 {
     Course course = new Course("Software Engineering");
     course.JoinCourse(new Student("Nikolay Kostadinov", 10000));
     course.LeaveCourse(new Student("Nikolay Kostadinov", 10029));
 }