public void ShouldBeTenFederalHolidaysPerYear() { const int YEAR = 2018; const int HOLIDAYS_PER_YEAR = 10; var holidays = _holidaysService.GetHolidaysByYear(YEAR); Assert.True(holidays.Count().Equals(HOLIDAYS_PER_YEAR)); }
public IActionResult Index(int?year) { IEnumerable <Holiday> holidays; var model = new HolidaysIndexViewModel(); if (!year.HasValue) { year = DateTime.UtcNow.Year; } try { holidays = _holidaysService.GetHolidaysByYear(year.Value); } catch (ArgumentException argEx) { model.Error = argEx.Message; holidays = new List <Holiday>(); } model.Year = year.Value; model.Holidays = holidays; return(View(model)); }