示例#1
0
        public void AddTeacherToRegistry()
        {
            Admin    admin    = new Admin();
            Register register = new Register(admin);

            register.AddTeacherUser("Name", "Password", "Email");

            Assert.AreEqual(register.Users.Count, 1);
            Assert.AreEqual(register.Users[0].MyPrivilege, User.Privilege.teacher);
        }
示例#2
0
        public void RemoveTeacherFromRegistry()
        {
            Admin    admin    = new Admin();
            Register register = new Register(admin);
            Teacher  teacher  = new Teacher("Name", "Password", "Email");

            register.AddTeacherUser(teacher);
            register.RemoveTeacherUser(teacher);

            Assert.AreEqual(register.Users.Count, 0);
        }
示例#3
0
        public void SearchUserWithEmail()
        {
            Admin    temp     = new Admin();
            Register register = new Register(temp);
            Admin    admin    = new Admin("temp", "temp", "password", User.Privilege.admin);
            Teacher  teacher  = new Teacher("temp", "temp2", "password", User.Privilege.teacher);

            register.AddAdminUser(admin);
            register.AddTeacherUser(teacher);

            Assert.AreEqual(register.SearchUserWithEmail("temp"), 0);
        }
示例#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);
        }