コード例 #1
0
        public async void GetAllAsync_ReturnsAllFromContext()
        {
            var expectedVenues = VenueGenerator.CreateList();

            using (var context = new booking_facilitiesContext(contextOptions))
            {
                context.Database.EnsureCreated();
                context.Venue.AddRange(expectedVenues);
                context.SaveChanges();

                Assert.Equal(expectedVenues.Count, await context.Venue.CountAsync());

                var repository = new VenueRepository(context);
                var resources  = repository.GetAllAsync();

                Assert.IsAssignableFrom <IQueryable <Venue> >(resources);
                Assert.Equal(expectedVenues, resources);
            }
        }