Example #1
0
        public void Create_ContainsCorrectModel()
        {
            var expectedResources = VenueGenerator.CreateList();

            //implement
            Assert.Equal(1, 2);
        }
        public async void GetByIdAsync_ReturnsCorrectItems()
        {
            var list     = VenueGenerator.CreateList(5);
            var expected = list[2];

            using (var context = new booking_facilitiesContext(contextOptions))
            {
                context.Database.EnsureCreated();
                context.Venue.AddRange(list);
                context.SaveChanges();
                Assert.Equal(list.Count, await context.Venue.CountAsync());
                var repository = new VenueRepository(context);
                var venue      = await repository.GetByIdAsync(expected.VenueId);

                Assert.IsType <Venue>(venue);
                Assert.Equal(expected, venue);
            }
        }
        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);
            }
        }