Esempio n. 1
0
        public async Task ListShowsByWeek()
        {
            //Arrange
            var context = TheatreContextInit.InitializeContextInMemoryDb();

            context.Shows.AddRange(
                new List <Show>()
            {
                new Show()
                {
                    Name      = "Hamlet vs Hamlet",
                    TimeSlots = new List <TimeSlot>()
                    {
                        new TimeSlot()
                        {
                            Start = Convert.ToDateTime("31-05-2018 20:00", CultureInfo.CurrentCulture),
                            End   = Convert.ToDateTime("31-05-2018 22:00", CultureInfo.CurrentCulture)
                        },

                        new TimeSlot()
                        {
                            Start = Convert.ToDateTime("02-06-2018 20:00", CultureInfo.CurrentCulture),
                            End   = Convert.ToDateTime("02-06-2018 22:00", CultureInfo.CurrentCulture)
                        },
                        new TimeSlot()
                        {
                            Start = Convert.ToDateTime("08-06-2018 20:00", CultureInfo.CurrentCulture),
                            End   = Convert.ToDateTime("08-06-2018 22:00", CultureInfo.CurrentCulture)
                        }
                    }
                },
                new Show()
                {
                    Name      = "Branden",
                    TimeSlots = new List <TimeSlot>()
                    {
                        new TimeSlot()
                        {
                            Start = Convert.ToDateTime("01-06-2018 20:00", CultureInfo.CurrentCulture),
                            End   = Convert.ToDateTime("01-06-2018 22:00", CultureInfo.CurrentCulture)
                        },
                        new TimeSlot()
                        {
                            Start = Convert.ToDateTime("15-06-2018 20:00", CultureInfo.CurrentCulture),
                            End   = Convert.ToDateTime("15-06-2018 22:00", CultureInfo.CurrentCulture)
                        }
                    }
                }
            });
            await context.SaveChangesAsync();

            var showsRepository = new ShowsRepository(context);
            //Act
            var listShows = await showsRepository.GetCalendarAsync();

            //Assert
            Assert.True(listShows.Any());
            Assert.True(listShows.First().Shows.Any());
        }
Esempio n. 2
0
 public async Task <IEnumerable <CalendarShows> > GetCalendarAsync()
 {
     return(await _repository.GetCalendarAsync());
 }