Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 3
0
        public void AddLessonOnOccupiedSlotTest()
        {
            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);
            Room     room     = new Room("Room");

            Lesson lesson = new Lesson(course, time, time, room);

            register.AddLesson(lesson);

            Assert.AreEqual(register.AddLesson(lesson), false);
        }
Esempio n. 4
0
        public void AddLessonTest()
        {
            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);



            Lesson lesson = new Lesson(course, time, time, new Room("Room"));

            register.AddLesson(lesson);

            Assert.AreEqual(register.Lessons.Count, 1);
        }