Exemple #1
0
        public void ShouldHaveErrorForYearBefore3000()
        {
            var req = new PreceptorReportRequest()
            {
                Year = 3000,
            };

            validator.ShouldHaveValidationErrorFor(x => x.Year, req);
        }
Exemple #2
0
        public void ShouldHaveErrorForNegativeID()
        {
            var req = new PreceptorReportRequest()
            {
                Id = -1,
            };

            validator.ShouldHaveValidationErrorFor(x => x.Id, req);
        }
Exemple #3
0
        public void ShouldBeValid()
        {
            var req = new PreceptorReportRequest()
            {
                Id   = 1,
                Year = 2020,
            };

            validator.ShouldNotHaveValidationErrorFor(x => x.Year, req);
            validator.ShouldNotHaveValidationErrorFor(x => x.Id, req);
        }
Exemple #4
0
        public async Task GetPreceptorReportsAsync(int id, int year, bool success)
        {
            var req = new PreceptorReportRequest()
            {
                Id   = id,
                Year = year,
            };
            ReportsService service = new ReportsService(timeRepo, reportMapper);
            var            result  = await service.GetPreceptorReportsAsync(req);

            if (success)
            {
                result.ShouldNotBeEmpty();
            }
            else
            {
                result.ShouldBeEmpty();
            }
        }
Exemple #5
0
        public async Task <IEnumerable <ReportResponse> > GetPreceptorReportsAsync(PreceptorReportRequest req)
        {
            var results = await _repo.GetTeacherAsync(req.Year, req.Id);

            return(results.Select(x => _mapper.Map(x)).ToList());
        }