コード例 #1
0
ファイル: CursusController.cs プロジェクト: HJWF/EndcaseWF
        // GET: api/Cursus/5
        public IEnumerable <CursusInstantie> GetCursusById(int id)
        {
            var cursussen = _repository.GetCursusInstanties();
            var cursussenForSpecificWeek = DateFilteringService.FilterOnWeek(cursussen, id);

            return(cursussenForSpecificWeek);
        }
コード例 #2
0
        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());
        }
コード例 #3
0
        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());
        }