public void ShouldBeValid()
        {
            var req = new ReportYearRequest()
            {
                Year = 2020,
            };

            validator.ShouldNotHaveValidationErrorFor(x => x.Year, req);
        }
        public void ShouldHaveErrorForYearBefore3000()
        {
            var req = new ReportYearRequest()
            {
                Year = 3000,
            };

            validator.ShouldHaveValidationErrorFor(x => x.Year, req);
        }
Esempio n. 3
0
        public async Task GetYearReportsAsync(int year, bool success)
        {
            var req = new ReportYearRequest()
            {
                Year = year,
            };
            ReportsService service = new ReportsService(timeRepo, reportMapper);
            var            result  = await service.GetYearReportsAsync(req);

            if (success)
            {
                result.ShouldNotBeEmpty();
            }
            else
            {
                result.ShouldBeEmpty();
            }
        }
Esempio n. 4
0
        public async Task <IEnumerable <ReportResponse> > GetYearReportsAsync(ReportYearRequest req)
        {
            var results = await _repo.GetYearAsync(req.Year);

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