def setUp(self): student_repo = studentRepo() assignment_repo = assignmentRepo() grade_repo = gradeRepo() 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_assingment_to_list(Assignment('127', 'Homework due Tomorrow', '2020-10-22'))
def setUp(self): student_repo = studentRepo() grade_repo = gradeRepo() student_validator = Student_Validator() undo_service = UndoService() student_service = studentService(student_repo, grade_repo, student_validator,undo_service) self._student_list = student_service self._student_list_repo = student_repo
def setUp(self): student_repo = studentRepo() assignment_repo = assignmentRepo() grade_repo = gradeRepo() 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
def test_removeassignmentservice(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 = studentRepo() assignment_repo = assignmentRepo() grade_repo = gradeRepo() 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)
def test_removestudentservice(self): stud = Student('123', 'Mark Park', '912') student_repo = studentRepo() assignment_repo = assignmentRepo() grade_repo = gradeRepo() 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)
from console.UI import UI, generateRandom from domain.assignment import Assignment,Assignment_Validator,AssignmentException,AssignmentValidatorException from domain.student import Student,Student_Validator,studentException,studentValidatorException from gui import GUI from repository.studentRepo import studentRepo,studentRepoException from service.studentService import studentService,studentServiceException from service.assignmentService import assignmentService,assignmentServiceException from repository.assignmentRepo import assignmentRepo from domain.grade import Grade,Grade_Validator,GradeExceptions from repository.gradeRepo import gradeRepo from service.gradeService import gradeService, gradeServiceException from service.UndoService import UndoService student_repo = studentRepo() assignment_repo = assignmentRepo() grade_repo = gradeRepo() 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) number = generateRandom(student_service, assignment_service, grade_service) number.generate_random_student() number.generate_random_assignment() number.generate_random_grades()