示例#1
0
        public void ShouldHaveErrorForNegativeID()
        {
            var req = new LearnerReportRequest()
            {
                Id = -1,
            };

            validator.ShouldHaveValidationErrorFor(x => x.Id, req);
        }
示例#2
0
        public void ShouldHaveErrorForYearBefore3000()
        {
            var req = new LearnerReportRequest()
            {
                Year = 3000,
            };

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

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

            if (success)
            {
                result.ShouldNotBeEmpty();
            }
            else
            {
                result.ShouldBeEmpty();
            }
        }
示例#5
0
        public async Task <IEnumerable <ReportResponse> > GetLearnerReportsAsync(LearnerReportRequest req)
        {
            var results = await _repo.GetLearnerAsync(req.Year, req.Id);

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