public IEnumerable <DateTime> GetWeekDates(int weeksFromNow) { for (int weekIndex = 0; weekIndex < weeksFromNow; weekIndex++) { yield return(StartOfWeek(_utc.Now().AddDays(7 * (weekIndex + 1)), WEEK_START)); } }
public BillboardCalculatorShould() { _repository = Substitute.For <IMoviesRepository>(); _utc = Substitute.For <IUtc>(); _utc.Now().Returns(new DateTime(2020, 02, 09)); _weekDates = new WeekDates(_utc); }
public ManagersControllerShould() { _repository = Substitute.For <IMoviesRepository>(); _utc = Substitute.For <IUtc>(); _utc.Now().Returns(new DateTime(2020, 02, 09)); _weekDates = new WeekDates(_utc); _logger = Substitute.For <ILogger <ManagersController> >(); }
public async void Not_Build_Weeks_With_Not_Released_Movies(int weeksFromNow, int bigRoomsScreens, int smallRoomsScreens) { //Arrange _utc.Now().Returns(new DateTime(2019, 08, 01)); var billBoardCalculator = new BillboardCalculator(_repository, _weekDates, weeksFromNow, bigRoomsScreens, smallRoomsScreens, false); var expectedMovies = BuildMovieInfosList(); _repository.GetMoviesInfo().Returns(expectedMovies); //Act var billBoard = await billBoardCalculator.GetBillboard(); //Assert billBoard.GetWeekBoard().Should().Match(w => w.First().BigScreenBoard.Count == bigRoomsScreens); billBoard.GetWeekBoard().Should().Match(w => w.First().BigScreenBoard.First().Movie.Title == expectedMovies.First().Title); billBoard.GetWeekBoard().Should().Match(w => w.Skip(1).First().BigScreenBoard.First().Movie.Title == expectedMovies.Skip(2).First().Title); billBoard.GetWeekBoard().Should().Match(w => w.Skip(2).First().BigScreenBoard.First().Movie.Title == expectedMovies.Skip(1).First().Title); billBoard.GetWeekBoard().Should().HaveCount(weeksFromNow); billBoard.GetWeekBoard().Should().Match(w => w.First().SmallScreenBoard.Count == smallRoomsScreens); billBoard.GetWeekBoard().Should().Match(w => w.First().SmallScreenBoard.First().Movie.Title == expectedMovies.Skip(6).First().Title&& w.First().BigScreenBoard.Count == bigRoomsScreens); billBoard.GetWeekBoard().Should().Match(w => w.Skip(1).First().SmallScreenBoard.First().Movie.Title == expectedMovies.Skip(4).First().Title&& w.First().BigScreenBoard.Count == bigRoomsScreens); }