コード例 #1
0
        public void DoesCursusInstantieExistReturnsFalseIfCursusInstanceDoesNotExist()
        {
            IEnumerable <CursusInstantie> cursusInstantieMock = null;

            _cursusRepositoryMock.Setup(x => x.GetCursusInstanties()).Returns(cursusInstantieMock);

            CursusInstantie cursusInstantie = CursusInstantieBuilder.New().Build();

            var result = _sut.DoesNotCursusInstantieExist(cursusInstantie);

            Assert.IsFalse(result);
        }
コード例 #2
0
        public void DoesCursusInstantieExistReturnsTrueIfCursusInstanceAlreadyExist()
        {
            CursusInstantie cursusInstantieMock = CursusInstantieBuilder.New().Build();

            _cursusRepositoryMock.Setup(x => x.GetCursusInstantieById(It.IsAny <int>())).Returns(cursusInstantieMock);

            var cursusInstantie = CursusInstantieBuilder.New().Build();

            var result = _sut.DoesNotCursusInstantieExist(cursusInstantie);

            Assert.IsTrue(result);
        }
コード例 #3
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());
        }
コード例 #4
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());
        }
コード例 #5
0
        public void GetCursussenInstantiesShouldReturnAQueryableOfCursusInstanties()
        {
            var cursusInstantiesQueryable = new List <CursusInstantie>
            {
                CursusInstantieBuilder.New().WithStartDate(new DateTime(2020, 02, 02)).Build(),
                CursusInstantieBuilder.New().WithStartDate(new DateTime(2020, 03, 03)).Build(),
                CursusInstantieBuilder.New().WithStartDate(new DateTime(2020, 04, 04)).Build(),
                CursusInstantieBuilder.New().WithStartDate(new DateTime(2020, 04, 04)).Build(),
                CursusInstantieBuilder.New().WithStartDate(new DateTime(2020, 04, 04)).Build()
            };

            _cursusInstantieRepositoryMock.Setup(x => x.GetCursusInstanties()).Returns(cursusInstantiesQueryable);

            var cursusInstanties = _sut.GetCursussen();

            Assert.IsNotNull(cursusInstanties);
            Assert.IsTrue(cursusInstanties.Count() == 5);
        }
コード例 #6
0
        public void DoesCursusInstantiesExistReturnsFalseIfCursusInstanceDoesNotExist()
        {
            IEnumerable <CursusInstantie> cursusInstantieMock = null;

            _cursusRepositoryMock.Setup(x => x.GetCursusInstanties()).Returns(cursusInstantieMock);

            var cursusInstanties = new List <CursusInstantie>
            {
                CursusInstantieBuilder.New().WithStartDate(new DateTime(2020, 02, 02)).Build(),
                CursusInstantieBuilder.New().WithStartDate(new DateTime(2020, 03, 03)).Build(),
                CursusInstantieBuilder.New().WithStartDate(new DateTime(2020, 04, 04)).Build(),
                CursusInstantieBuilder.New().WithStartDate(new DateTime(2020, 05, 05)).Build(),
                CursusInstantieBuilder.New().WithStartDate(new DateTime(2020, 06, 06)).Build()
            };

            var result = _sut.DoesCursusInstantiesExist(cursusInstanties);

            Assert.IsFalse(result);
        }
コード例 #7
0
        public void DoesCursusInstantiesExistReturnsTrueIfCursusInstanceAlreadyExist()
        {
            CursusInstantie cursusInstantieMock = CursusInstantieBuilder.New().WithStartDate(new DateTime(2020, 02, 02)).Build();

            _cursusRepositoryMock.Setup(x => x.GetCursusInstantieById(It.IsAny <int>())).Returns(cursusInstantieMock);

            var cursusInstanties = new List <CursusInstantie>
            {
                CursusInstantieBuilder.New().WithStartDate(new DateTime(2020, 02, 02)).Build(),
                CursusInstantieBuilder.New().WithStartDate(new DateTime(2020, 03, 03)).Build(),
                CursusInstantieBuilder.New().WithStartDate(new DateTime(2020, 04, 04)).Build(),
                CursusInstantieBuilder.New().WithStartDate(new DateTime(2020, 04, 04)).Build(),
                CursusInstantieBuilder.New().WithStartDate(new DateTime(2020, 04, 04)).Build()
            };

            var result = _sut.DoesCursusInstantiesExist(cursusInstanties);

            Assert.IsTrue(result);
        }