// GET: api/Cursus/5 public IEnumerable <CursusInstantie> GetCursusById(int id) { var cursussen = _repository.GetCursusInstanties(); var cursussenForSpecificWeek = DateFilteringService.FilterOnWeek(cursussen, id); return(cursussenForSpecificWeek); }
public void FilterOnWeekShouldReturnTheCorrectCursusses() { var cursusInstanties = new List <CursusInstantie> { CursusInstantieBuilder.New().WithStartDate(_date).Build() }; var yearWeek = 202027; var result = DateFilteringService.FilterOnWeek(cursusInstanties, yearWeek); Assert.AreEqual(1, result.Count()); }
public void FilterOnWeekShouldOnlyReturnTheCursussenForSpecificWeekNumber() { var cursusInstanties = new List <CursusInstantie> { CursusInstantieBuilder.New().WithStartDate(_date).Build(), CursusInstantieBuilder.New().WithStartDate(_date.AddDays(30)).Build(), CursusInstantieBuilder.New().WithStartDate(_date.AddDays(-30)).Build(), CursusInstantieBuilder.New().WithStartDate(_date.AddDays(2)).Build(), }; var yearWeek = 202027; var result = DateFilteringService.FilterOnWeek(cursusInstanties, yearWeek); Assert.AreEqual(2, result.Count()); }