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); }
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); }
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()); }
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); }
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); }
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); }