コード例 #1
0
    def setUp(self):

        student_repo = Repository()
        assignment_repo = Repository()
        grade_repo = Repository()
        student_validator = Student_Validator()
        assignment_validator = Assignment_Validator()
        grade_validator = Grade_Validator()
        self._undo_service = UndoService()

        student_service = studentService(student_repo, grade_repo, student_validator, self._undo_service )
        assignment_service = assignmentService(assignment_repo, grade_repo, assignment_validator, self._undo_service)
        grade_service = gradeService(student_repo, assignment_repo, grade_repo, student_validator, assignment_validator,grade_validator, self._undo_service)

        student_validator = Student_Validator()
        assignment_validator = Assignment_Validator()
        grade_validator = Grade_Validator()

        self._student_list = student_service
        self._assignment_list = assignment_service
        self._grade_list = grade_service
        self.list_s.add_student('124', 'Mark Park', '912')
        self.list_s.add_student('125', 'Mark Park', '912')
        self.list_s.add_student('126', 'Mark Park', '912')
        self.list_s.add_student('127', 'Mark Park', '913')
        self.list_s.add_student('128', 'Mark Park', '914')
        self.assing_list.add_assignment('124', 'Homework due Tomorrow', '2021-12-22')
        self.assing_list.add_assignment('125', 'Homework due Tomorrow', '2021-12-22')
        self.assing_list.add_assignment('126', 'Homework due Tomorrow', '2021-12-22')
        self.assing_list.list_of_assignments.add_object(Assignment('127', 'Homework due Tomorrow', '2020-10-22'))
コード例 #2
0
    def setUp(self):
        student_repo = Repository()
        assignment_repo = Repository()
        grade_repo = Repository()
        student_validator = Student_Validator()
        assignment_validator = Assignment_Validator()
        grade_validator = Grade_Validator()
        undo_service = UndoService()
        self._undo_service = undo_service
        student_service = studentService(student_repo, grade_repo, student_validator, self._undo_service )
        assignment_service = assignmentService(assignment_repo, grade_repo, assignment_validator, self._undo_service)
        grade_service = gradeService(student_repo, assignment_repo, grade_repo, student_validator, assignment_validator,grade_validator, self._undo_service)

        self._grades_list = grade_service
        self._assignments = assignment_service
        self._student_list = student_service
コード例 #3
0
    def test_remove_assignment_service(self):
        self.assing_list.add_assignment('124', 'Homework due Tomorrow',
                                        '2021-12-22')
        self.assing_list.add_assignment('125', 'Homework due Tomorrow',
                                        '2021-12-22')
        self.assing_list.add_assignment('126', 'Homework due Tomorrow',
                                        '2021-12-22')
        self.assing_list.add_assignment('127', 'Homework due Tomorrow',
                                        '2021-12-22')

        student_repo = Repository()
        assignment_repo = Repository()
        grade_repo = Repository()

        student_validator = Student_Validator()
        assignment_validator = Assignment_Validator()
        grade_validator = Grade_Validator()
        g_list = gradeService(student_repo, assignment_repo, grade_repo,
                              student_validator, assignment_validator,
                              grade_validator, self._undo_service)
        self.assing_list.remove_assignment('124')

        self.assertEqual(len(self.assing_list.list_of_assignments), 3)

        try:
            self.assing_list.remove_assignment('124')
            self.assertFalse('Not good')
        except AssignmentException:
            self.assertTrue('OK')

        try:
            self.assing_list.remove_assignment('124a')
            self.assertFalse('Not good')
        except AssignmentException:
            self.assertTrue('OK')

        try:
            self.assing_list.remove_assignment('125')
            self.assertTrue('OK')
        except AssignmentException:
            self.assertFalse('Not good')
        self.assertEqual(len(self.assing_list.list_of_assignments), 2)
コード例 #4
0
    def test_remove_student_service(self):
        stud = Student('123', 'Mark Park', '912')
        student_repo = Repository()
        assignment_repo = Repository()
        grade_repo = Repository()

        student_validator = Student_Validator()
        assignment_validator = Assignment_Validator()
        grade_validator = Grade_Validator()
        undo_service = UndoService()
        g_list = gradeService(student_repo, assignment_repo, grade_repo,
                              student_validator, assignment_validator,
                              grade_validator, undo_service)
        self.list_s.add_student('234', 'Mark Park', '912')
        self.list_s.add_student('235', 'Mark Park', '912')
        self.list_s.add_student('236', 'Mark Park', '912')
        self.list_s.remove_student('234')

        self.assertEqual(len(self.list_s.student_list_service), 2)

        try:
            self.list_s.remove_student('234')
            self.assertFalse('Not good')
        except studentException:
            self.assertTrue('OK')

        try:
            self.list_s.remove_student('za2')
            self.assertFalse('Not good')
        except studentException:
            self.assertTrue('OK')

        try:
            self.list_s.remove_student('392')
            self.assertFalse('Not good')
        except studentException:
            self.assertTrue('OK')
        self.assertEqual(len(self.list_s.student_list_service), 2)
コード例 #5
0
        print(str(ve))
        exit(0)

    # we now initialize the validators and so on
    student_validator = Student_Validator()
    assignment_validator = Assignment_Validator()
    grade_validator = Grade_Validator()

    undo_service = UndoService()

    student_service = studentService(student_repo, grade_repo,
                                     student_validator, undo_service)
    assignment_service = assignmentService(assignment_repo, grade_repo,
                                           assignment_validator, undo_service)
    grade_service = gradeService(student_repo, assignment_repo, grade_repo,
                                 student_validator, assignment_validator,
                                 grade_validator, undo_service)

    # we add random data if we use the inmemory storing method
    if repoSetUp.get_mode == "inmemory":
        number = generateRandom(student_service, assignment_service,
                                grade_service)
        number.generate_random_student()
        number.generate_random_assignment()
        number.generate_random_grades()

    if repoSetUp.get_uimode == "gui":
        gui = GUI(student_service, assignment_service, grade_service,
                  undo_service)
        gui.start()
    elif repoSetUp.get_uimode == "menu":