public void Then_If_The_CurrentDate_Exceeds_The_Max_Date_It_IsNot_Added( [Frozen] Mock <ICurrentDateTime> currentDateTime, Mock <IOptions <ReservationsConfiguration> > mockOptions) { var expectedDateTime = DateTime.Today.AddDays(1); currentDateTime.Setup(x => x.GetDate()).Returns(expectedDateTime); var config = mockOptions.Object.Value; config.AvailableDatesMinDate = null; config.AvailableDatesMaxDate = DateTime.Today; var availableDatesService = new AvailableDatesService(mockOptions.Object, currentDateTime.Object); //Act var actualDates = availableDatesService.GetAvailableDates(); //Assert actualDates.Count().Should().Be(0); }
public void Then_Uses_AvailableDates( [Frozen] Mock <ICurrentDateTime> currentDateTime, Mock <IOptions <ReservationsConfiguration> > mockOptions) { currentDateTime.Setup(x => x.GetDate()).Returns(DateTime.UtcNow); var config = mockOptions.Object.Value; var expectedDates = new AvailableDates( DateTime.UtcNow, config.NumberOfAvailableDates, config.AvailableDatesMinDate, config.AvailableDatesMaxDate) .Dates; var availableDatesService = new AvailableDatesService(mockOptions.Object, currentDateTime.Object); //Act var actualDates = availableDatesService.GetAvailableDates(); //Assert actualDates.Should().BeEquivalentTo(expectedDates); }