public void ShouldHaveErrorForNegativeID() { var req = new LearnerReportRequest() { Id = -1, }; validator.ShouldHaveValidationErrorFor(x => x.Id, req); }
public void ShouldHaveErrorForYearBefore3000() { var req = new LearnerReportRequest() { Year = 3000, }; validator.ShouldHaveValidationErrorFor(x => x.Year, req); }
public void ShouldBeValid() { var req = new LearnerReportRequest() { Id = 1, Year = 2020, }; validator.ShouldNotHaveValidationErrorFor(x => x.Year, req); validator.ShouldNotHaveValidationErrorFor(x => x.Id, req); }
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(); } }
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()); }