public async Task GivenTwoAddressesInDatabase_WhenIDelete_ItDeletesTheCorrectAddress()
        {
            var venue1 = GetNewVenue();
            var venue2 = GetNewVenue();

            using (var context = new DefaultContext(DbContextOptions))
            {
                var venueRepository = new VenueRepository(context);

                venue1 = await venueRepository.CreateAsync(venue1);

                venue2 = await venueRepository.CreateAsync(venue2);

                List <VenueDb> allVenues = await context.Venues.ToListAsync();

                Assert.AreEqual(2, allVenues.Count);
            }
            using (var context = new DefaultContext(DbContextOptions))
            {
                var venueRepository = new VenueRepository(context);
                await venueRepository.DeleteAsync(venue2.Id);

                List <VenueDb> allVenues = await context.Venues.ToListAsync();

                Assert.AreEqual(1, allVenues.Count);

                Assert.IsNull(await context.Venues.FindAsync(venue2.Id));
            }
        }
        public async Task GivenTwoAddressesInDatabase_WhenIGetById_ItReturnsTheCorrectAddress()
        {
            using (var context = new DefaultContext(DbContextOptions))
            {
                var venueRepository = new VenueRepository(context);

                await venueRepository.CreateAsync(GetNewVenue());

                await venueRepository.CreateAsync(GetNewVenue());

                VenueDb venue = await context.Venues.FindAsync(2);

                Assert.AreEqual(2, venue.Id);
            };
        }
        public async Task GivenTwoVenuesInDatabase_WhenIGetAll_ItReturns2Venues()
        {
            using (var context = new DefaultContext(DbContextOptions))
            {
                var venueRepository = new VenueRepository(context);

                await venueRepository.CreateAsync(GetNewVenue());

                await venueRepository.CreateAsync(GetNewVenue());

                List <VenueDb> allVenues = await context.Venues.ToListAsync();

                Assert.AreEqual(2, allVenues.Count);
            }
        }
        public async Task GivenTwoAddressesInDatabase_WhenIUpdate_ItUpdatesTheCorrectAddress()
        {
            using (var context = new DefaultContext(DbContextOptions))
            {
                var venueRepository = new VenueRepository(context);

                var venue1 = GetNewVenue();
                var venue2 = GetNewVenue();
                venue1 = await venueRepository.CreateAsync(venue1);

                venue2 = await venueRepository.CreateAsync(venue2);

                venue2.Name = "test update";

                await venueRepository.UpdateAsync(venue2);

                var updatedVenue = await context.FindAsync <VenueDb>(venue2.Id);

                Assert.AreEqual(venue2.Name, updatedVenue.Name);
                Assert.AreEqual(venue2.Email, updatedVenue.Email);
                Assert.AreEqual(venue2.Phone, updatedVenue.Phone);
                Assert.AreEqual(venue2.Website, updatedVenue.Website);
            }
        }
        public async Task GivenANewVenue_WhenICreateAVenue_ItCreatesAVenue()
        {
            using (var context = new DefaultContext(DbContextOptions))
            {
                var venue           = GetNewVenue();
                var venueRepository = new VenueRepository(context);

                await venueRepository.CreateAsync(venue);

                List <VenueDb> allVenuesDb = await context.Venues.ToListAsync();

                Assert.AreEqual(1, allVenuesDb.Count);
                Assert.AreEqual(1, allVenuesDb[0].Id);
                Assert.AreEqual(venue.Email, allVenuesDb[0].Email);
                Assert.AreEqual(venue.Website, allVenuesDb[0].Website);
                Assert.AreEqual(venue.Name, allVenuesDb[0].Name);
                Assert.AreEqual(venue.Phone, allVenuesDb[0].Phone);
                Assert.AreEqual(venue.VenueType, allVenuesDb[0].VenueType);
                Assert.AreEqual(venue.Address, allVenuesDb[0].Address);
                Assert.IsNotNull(venue.Address);
                Assert.IsNotNull(venue.createdDateUtc);
                Assert.IsNotNull(venue.modifiedDateUtc);
            }
        }