Пример #1
0
        public void ShowLessonsForStudentTest()
        {
            Admin    admin    = new Admin();
            Register register = new Register(admin);
            Teacher  teacher  = new Teacher("Name", "Email", "Password", User.Privilege.teacher);
            DateTime time     = DateTime.Now;
            Course   course   = new Course("Name", teacher, time, time, 5);
            Student  student  = new Student("student", "email", "password");

            course.AddStudent(student);


            Lesson lesson1 = new Lesson(course, time, time, new Room("Room1"));
            Lesson lesson2 = new Lesson(course, time, time, new Room("Room2"));
            Lesson lesson3 = new Lesson(course, time, time, new Room("Room3"));

            register.AddCourse(course);
            register.AddLesson(lesson1);
            register.AddLesson(lesson2);
            register.AddLesson(lesson3);

            Assert.AreEqual(register.GetLessonsStudent(student).Contains(lesson1), true);
            Assert.AreEqual(register.GetLessonsStudent(student).Contains(lesson2), true);
            Assert.AreEqual(register.GetLessonsStudent(student).Contains(lesson3), true);
        }
Пример #2
0
        public void ShowLessonsForRoomTest()
        {
            Admin    admin    = new Admin();
            Register register = new Register(admin);
            Teacher  teacher  = new Teacher("Name", "Email", "Password", User.Privilege.teacher);
            DateTime time1    = new DateTime(2017, 12, 12);
            DateTime time2    = new DateTime(2018, 12, 12);
            DateTime time3    = new DateTime(2019, 12, 12);
            Course   course   = new Course("Name", teacher, time1, time1, 5);
            Room     room     = new Room("Room");



            Lesson lesson1 = new Lesson(course, time1, time1, room);
            Lesson lesson2 = new Lesson(course, time2, time2, room);
            Lesson lesson3 = new Lesson(course, time3, time3, room);

            register.AddCourse(course);
            register.AddRoom(room);
            register.AddLesson(lesson1);
            register.AddLesson(lesson2);
            register.AddLesson(lesson3);

            Assert.AreEqual(register.GetLessonsRoom(room).Contains(lesson1), true);
            Assert.AreEqual(register.GetLessonsRoom(room).Contains(lesson2), true);
            Assert.AreEqual(register.GetLessonsRoom(room).Contains(lesson3), true);
        }
Пример #3
0
        public void AddCourseToRegistry()
        {
            Admin    admin    = new Admin();
            Register register = new Register(admin);
            Teacher  teacher  = new Teacher("Name", "Email", "Password", User.Privilege.teacher);
            DateTime time     = DateTime.Now;
            Course   course   = new Course("Name", teacher, time, time, 5);

            register.AddCourse(course);

            Assert.AreEqual(register.Courses.Count, 1);
        }
Пример #4
0
        public void CoursesLoadsAListOfAttendingStudents()
        {
            Admin    admin    = new Admin();
            Register register = new Register(admin);
            Teacher  teacher  = new Teacher();
            Course   course   = new Course();

            course.AddTeacher(teacher);

            register.AddTeacherUser(teacher);
            register.AddCourse(course);
            register.SaveCourse();
            register         = new Register();
            register.Courses = register.LoadCourses();

            Assert.AreEqual(register.Courses.Count, 1);
        }
Пример #5
0
        public void SaveCourseToXmlFileTest()
        {
            Admin    admin    = new Admin();
            Register register = new Register(admin);
            Course   course   = new Course("Svenska");
            Teacher  teacher  = new Teacher();

            course.AddTeacher(teacher);

            register.AddTeacherUser(teacher);
            register.AddCourse(course);
            register.SaveCourse();
            register         = new Register();
            register.Courses = register.LoadCourses();

            Assert.AreEqual(register.Courses.Count, 1);
            Assert.AreEqual(register.Courses[0].Name, "Svenska");
        }
Пример #6
0
        public void CourseSavesStudents()
        {
            Admin    admin    = new Admin();
            Register register = new Register(admin);
            Student  student  = new Student("temp", "temp", "temp");
            Teacher  teacher  = new Teacher("techer", "teacher", "teacher");
            Course   course   = new Course();

            register.AddStudentUser(student);
            register.AddTeacherUser(teacher);
            course.AddStudent(student);
            course.AddTeacher(teacher);

            register.AddCourse(course);
            register.SaveCourse();
            register         = new Register();
            register.Courses = register.LoadCourses();

            Assert.AreEqual(register.Courses[0].Students.Count, 1);
        }