예제 #1
0
        public async Task CreateGrade_WithAnotherTermGrade_ShouldReturnFalse()
        {
            string errorMessagePrefix = "GradeService CreateGradeAsync() does not work properly.";

            var context = NetBookDbContextInMemoryFactory.InitializeContext();

            await this.SeedData(context);

            this.gradeService = new GradeService(context);

            var studentId = "TestStudent";
            var subjectId = "TestSubject";

            var testGrade = new GradeServiceModel
            {
                GradeValue  = "5",
                Term        = Term.Първи,
                IsTermGrade = true,
                StudentId   = studentId,
                SubjectId   = subjectId,
            };

            var actualResult = await this.gradeService.CreateGradeAsync(testGrade);

            Assert.True(!actualResult, errorMessagePrefix + " " + "Another term grade is added");
        }
예제 #2
0
        public async Task EditGrade_WithExistentId_ShouldSuccessfullyEditGrade()
        {
            string errorMessagePrefix = "GradeService EditGradeAsync() does not work properly.";

            var context = NetBookDbContextInMemoryFactory.InitializeContext();

            await this.SeedData(context);

            this.gradeService = new GradeService(context);

            var testId = context.Grades.First().Id;

            var editGrade = new GradeServiceModel
            {
                Id          = testId,
                GradeValue  = "3",
                Term        = Term.Втори,
                IsTermGrade = false,
            };

            var actualResult = await this.gradeService.EditGradeAsync(editGrade);

            Assert.True(actualResult, errorMessagePrefix);

            var editedGrade = context.Grades.First();

            Assert.True(editedGrade.GradeValue == editGrade.GradeValue, errorMessagePrefix + " " + "GradeValue is not set properly.");
            Assert.True(editedGrade.Term == editGrade.Term, errorMessagePrefix + " " + "Term is not set properly.");
            Assert.True(editedGrade.IsTermGrade == editGrade.IsTermGrade, errorMessagePrefix + " " + "IsTermGrade is not set properly.");
        }
예제 #3
0
        public async Task CreateGrade_WithCorrectData_ShouldSuccessfullyCreateGrade()
        {
            string errorMessagePrefix = "GradeService CreateGradeAsync() does not work properly.";

            var context = NetBookDbContextInMemoryFactory.InitializeContext();

            await this.SeedData(context);

            this.gradeService = new GradeService(context);

            var student = context.Students.First();

            var testGrade = new GradeServiceModel
            {
                Id          = "TestCreateGrade",
                GradeValue  = "5",
                Term        = Term.Втори,
                IsTermGrade = false,
                Student     = student.To <StudentServiceModel>(),
                StudentId   = student.Id,
            };

            var actualResult = await this.gradeService.CreateGradeAsync(testGrade);

            var grade = context.Grades.Find("TestCreateGrade");

            Assert.True(actualResult, errorMessagePrefix);
            Assert.True(grade.GradeValue == testGrade.GradeValue, errorMessagePrefix + " " + "GradeValue is not set properly.");
            Assert.True(grade.Term == testGrade.Term, errorMessagePrefix + " " + "Term is not set properly.");
            Assert.True(grade.IsTermGrade == testGrade.IsTermGrade, errorMessagePrefix + " " + "IsTermGrade is not set properly.");
            Assert.True(grade.StudentId == testGrade.StudentId, errorMessagePrefix + " " + "StudentId is not set properly");
        }
예제 #4
0
        public async Task GetAllGrades_WithDummyData_ShouldReturnCorrectResults()
        {
            string errorMessagePrefix = "GradeService GetAllGrades() does not work properly.";

            var context = NetBookDbContextInMemoryFactory.InitializeContext();

            await this.SeedData(context);

            this.gradeService = new GradeService(context);

            var actualResult = await this.gradeService.GetAllGrades().ToListAsync();

            var expectedResult = await context.Grades.To <GradeServiceModel>().ToListAsync();

            Assert.True(expectedResult.Count == actualResult.Count, errorMessagePrefix);

            for (int i = 0; i < expectedResult.Count; i++)
            {
                var actualEntity   = actualResult[i];
                var expectedEntity = expectedResult[i];

                Assert.True(expectedEntity.GradeValue == actualEntity.GradeValue, errorMessagePrefix + " " + "Grade Value is not returned properly.");
                Assert.True(expectedEntity.Term == actualEntity.Term, errorMessagePrefix + " " + "Term is not returned properly.");
                Assert.True(expectedEntity.IsTermGrade == actualEntity.IsTermGrade, errorMessagePrefix + " " + "IsTermGrade is not returned properly.");
                Assert.True(expectedEntity.Subject.Subject.Name == actualEntity.Subject.Subject.Name, errorMessagePrefix + " " + "Subject Name is not returned properly.");
                Assert.True(expectedEntity.Student.FullName == actualEntity.Student.FullName, errorMessagePrefix + " " + "Student FullName is not returned properly.");
            }
        }
예제 #5
0
 public TimetableController(IPupilService pservice, ITeacherGradeService service, IGradeService gservice, ITeacherService tservice)
 {
     pupilService   = pservice;
     tgService      = service;
     gradeService   = gservice;
     teacherService = tservice;
 }
예제 #6
0
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public GradeController(IGradeService gradeService, ITeacherService teacherService, ICourseService courseService, ILog log)
        {
            _gradeService   = gradeService;
            _teacherService = teacherService;
            _courseService  = courseService;
            _logger         = log;
        }
예제 #7
0
        public FrmMainTeacher(
            IGradeService gradeService,
            IComboBoxHelperService comboBoxHelperService,
            IUserService userService,
            IUserRepository userRepository,
            IParentRepository parentRepository,
            ITeacherRepository teacherRepository,
            IStudentRepository studentRepository,
            IMessageRepository messageRepository,
            IClassRepository classRepository,
            IGradesTabService gradesTabService,
            ITeacherService teacherService,
            IMessagesTabService messagesTabService)
        {
            _comboBoxHelperService = comboBoxHelperService;
            _userService           = userService;
            _userRepository        = userRepository;
            _parentRepository      = parentRepository;
            _teacherRepository     = teacherRepository;
            _studentRepository     = studentRepository;
            _messageRepository     = messageRepository;
            _classRepository       = classRepository;
            _gradesTabService      = gradesTabService;
            _teacherService        = teacherService;
            _messagesTabService    = messagesTabService;

            InitializeComponent();

            Initialize();
        }
예제 #8
0
 public GradeController(IGradeService gradeService, ISubjectService subjectService, IStudentService studentService, UserManager <User> userManager)
 {
     _gradeService   = gradeService;
     _subjectService = subjectService;
     _studentService = studentService;
     _userManager    = userManager;
 }
 public GroupController(IFixGroupService fixGroupService, ISeminarGroupService seminarGroupService, ITopicService topicService, IGradeService gradeService)
 {
     _fixGroupService     = fixGroupService;
     _seminarGroupService = seminarGroupService;
     _topicService        = topicService;
     _gradeService        = gradeService;
 }
예제 #10
0
 public BuveraService(IBuveraDataService dataService, IUserService userService, IGradeService gradeService, IStoreService storeService)
 {
     this._dataService  = dataService;
     this._userService  = userService;
     this._gradeService = gradeService;
     this._storeService = storeService;
 }
        private GradeController GetController(IGradeService service, IIdentityProvider identityProvider, IValidateService validateService)
        {
            var claimPrincipal = new Mock <ClaimsPrincipal>();
            var claims         = new Claim[]
            {
                new Claim("username", "unittestusername")
            };

            claimPrincipal.Setup(claim => claim.Claims).Returns(claims);

            var controller = new GradeController(service, identityProvider, validateService)
            {
                ControllerContext = new ControllerContext()
                {
                    HttpContext = new DefaultHttpContext()
                    {
                        User = claimPrincipal.Object
                    }
                }
            };

            controller.ControllerContext.HttpContext.Request.Headers["Authorization"]     = "Bearer unittesttoken";
            controller.ControllerContext.HttpContext.Request.Headers["x-timezone-offset"] = $"{It.IsAny<int>()}";
            controller.ControllerContext.HttpContext.Request.Path = new PathString("/v1/unit-test");

            return(controller);
        }
예제 #12
0
        public void Setup()
        {
            IKernel kernel = new StandardKernel();

            kernel.Load(Assembly.GetExecutingAssembly());
            GradeService = kernel.Get <IGradeService>();
        }
 public CourseController(
     ICoursesService coursesService,
     ITeachersService teachersService,
     ISubjectsService subjectsService,
     ISubjectTeachersService subjectTeachersService,
     ICourseSubjectsService courseSubjectsService,
     ICourseSubjectTeacherService courseSubjectTeacherService,
     IStudentSubjectsService studentSubjectsService,
     IAttendancesService attendancesService,
     IGradeService gradeService,
     ApplicationDbContext db,
     UserManager <ApplicationUser> userManager)
 {
     this.coursesService              = coursesService;
     this.teachersService             = teachersService;
     this.subjectsService             = subjectsService;
     this.subjectTeachersService      = subjectTeachersService;
     this.courseSubjectsService       = courseSubjectsService;
     this.courseSubjectTeacherService = courseSubjectTeacherService;
     this.studentSubjectsService      = studentSubjectsService;
     this.attendancesService          = attendancesService;
     this.gradeService = gradeService;
     this.db           = db;
     this.userManager  = userManager;
 }
예제 #14
0
 public SubjectsController(ISubjectService subjectService, IStudentService studentService, ITeacherService teacherService, IGradeService gradeService)
 {
     this.subjectService = subjectService;
     this.studentService = studentService;
     this.teacherService = teacherService;
     this.gradeService   = gradeService;
 }
 public HomeController(IUserService userService, IRoleService roleService, IGradeService gradeService, IBookService bookService, IFriendshipService friendshipService)
 {
     this.userService = userService;
     this.roleService = roleService;
     this.gradeService = gradeService;
     this.bookService = bookService;
     this.friendshipService = friendshipService;
 }
예제 #16
0
 public StudentController(IStudentService studentService, IGroupService groupService, UserManager <User> userManager, ITeacherService teacherService, IGradeService gradeService)
 {
     _studentService = studentService;
     _groupService   = groupService;
     _userManager    = userManager;
     _teacherService = teacherService;
     _gradeService   = gradeService;
 }
예제 #17
0
 public GradeController(IGradeService service, IPupilService pservice, ITeacherService tservice, ITeacherGradeService tgservice, ISubjectService sservice)
 {
     gradeService   = service;
     pupilService   = pservice;
     teacherService = tservice;
     tgService      = tgservice;
     subjectService = sservice;
 }
예제 #18
0
 public GradeController(IGradeService GradeService,
                        IGradeService gradeService,
                        IMapper mapper)
 {
     _GradeService = GradeService;
     _gradeService = gradeService;
     _mapper       = mapper;
 }
 public BookController(IBookService bookService, IAuthorService authorService, IGradeService gradeService, IGenreService genreService, IUserService userService)
 {
     this.bookService = bookService;
     this.authorService = authorService;
     this.gradeService = gradeService;
     this.genreService = genreService;
     this.userService = userService;
 }
예제 #20
0
 public GradesController(SchoolDBContext schoolDBContext,
                         IMasterService masterService,
                         IGradeService gradeService)
 {
     _schoolDBContext = schoolDBContext;
     _masterService   = masterService;
     _gradeService    = gradeService;
 }
 public GradeController(UserManager <User> userManager, IGradeService gradeService, IParentService parentService,
                        IStringLocalizer <GradeController> localizer, ILoggerFactory loggerFactory
                        ) : base(localizer, loggerFactory)
 {
     _gradeService  = gradeService;
     _parentService = parentService;
     _userManager   = userManager;
 }
예제 #22
0
 public static void Initialize(TestContext context)
 {
     _logger     = new Mock <ILog>();
     _unitOfWork = new MockUnitOfWork();
     _rep        = new Mock <IRepository <Grade> >();
     SetupMockRepository();
     _gradeService = new GradeService(_logger.Object, _unitOfWork);
 }
예제 #23
0
 public DashboardController(UserManager <User> userManager, ICourseService courseService, IUserService userService, IGradeService gradeService, IExporter exporter)
 {
     this.userManager   = userManager;
     this.courseService = courseService;
     this.userService   = userService;
     this.gradeService  = gradeService;
     this.exporter      = exporter;
 }
예제 #24
0
 public UniversityController(IStudentService StudentService, ITeacherService TeacherService, IUserService UserService, ISubjectService SubjectService, IGradeService GradeService)
 {
     studentService = StudentService;
     teacherService = TeacherService;
     userService    = UserService;
     subjectService = SubjectService;
     gradeService   = GradeService;
 }
예제 #25
0
 public GroupController(ISeminarGroupService iSeminarGroupService, IFixGroupService iFixGroupService, ITopicService iTopicService, IUserService iUserService, IGradeService iGradeService)
 {
     _iSeminarGroupService = iSeminarGroupService;
     _iFixGroupService     = iFixGroupService;
     _iTopicService        = iTopicService;
     _iUserService         = iUserService;
     _iGradeService        = iGradeService;
 }
예제 #26
0
 public TeacherController(IStudentService studentService, ISubjectService subjectService, UserManager <User> userManager, IGradeService gradeService, ITeacherService teacherService)
 {
     _studentService = studentService;
     _subjectService = subjectService;
     _userManager    = userManager;
     _gradeService   = gradeService;
     _teacherService = teacherService;
 }
예제 #27
0
 public GroupController(
     IClusterClient client,
     JwtHeader header)
 {
     _fixGroupService     = client.GetGrain <IFixGroupService>(0);
     _seminarGroupService = client.GetGrain <ISeminarGroupService>(0);
     _topicService        = client.GetGrain <ITopicService>(0);
     _gradeService        = client.GetGrain <IGradeService>(0);
 }
예제 #28
0
 public SchoolController(ISchoolsService schoolsService, ISchoolYearsService schoolYearsService, ISemestersService semestersService, IConfiguration config, ICohortService cohortService, IGradeService gradeService)
 {
     _schoolsService     = schoolsService;
     _schoolYearsService = schoolYearsService;
     _semestersService   = semestersService;
     _gradeService       = gradeService;
     _cohortService      = cohortService;
     _config             = config;
 }
예제 #29
0
 public UserInfoController(IUserInfoService userService, IGradeService gradeService,
                           ISysGroupService sysGroupService,
                           IImageInfoService imageInfoService)
 {
     _userService      = userService;
     _gradeService     = gradeService;
     _sysGroupService  = sysGroupService;
     _imageInfoService = imageInfoService;
 }
 public GradeController(IMapper mapper, IGradeService gradeService, ISubjectService subjectService, IStudentService studentService,
                        UserManager <User> userManager, IStringLocalizer <GradeController> localizer, ILoggerFactory loggerFactory) : base(localizer, loggerFactory)
 {
     _mapper         = mapper;
     _gradeService   = gradeService;
     _subjectService = subjectService;
     _studentService = studentService;
     _userManager    = userManager;
 }
예제 #31
0
 public MarksController(IMarkService markService, IStudentService studentService, ITeacherService teacherService, ISubjectService subjectService, IGradeService gradeService, ISemesterService semesterService)
 {
     this.markService     = markService;
     this.studentService  = studentService;
     this.teacherService  = teacherService;
     this.subjectService  = subjectService;
     this.gradeService    = gradeService;
     this.semesterService = semesterService;
 }
예제 #32
0
 public SchoolClassesController(
     ISchoolClassService schoolClassService,
     IGradeService gradeService,
     IAcademicYearService academicYearService)
 {
     this.schoolClassService  = schoolClassService;
     this.gradeService        = gradeService;
     this.academicYearService = academicYearService;
 }