public override async Task UpdateWithNoIdShouldReturnExceptionAsync()
        {
            int id = 1000;

            var options = new DbContextOptionsBuilder <Project15Context>()
                          .UseInMemoryDatabase("db_eventcustomer_test_update").Options;

            // arrange (use the context directly - we assume that works)
            using (var db = new Project15Context(options));

            // assert (for assert, once again use the context directly for verify.)
            using (var db = new Project15Context(options))
            {
                var repo = new EventCustomerRepository(db);

                EventCustomer eventCustomer = await repo.GetByIdAsync(id);

                Assert.Null(eventCustomer);

                await Assert.ThrowsAsync <ArgumentException>(() => repo.UpdateAsync(eventCustomer, id));
            }
        }
        public override async Task UpdateWorksAsync()
        {
            int id      = 0;
            int wrongId = 10;

            EventCustomer eventCustomerSaved = null;
            Event         EventSaved         = null;
            Customer      customerSaved      = null;

            // arrange (use the context directly - we assume that works)
            var options = new DbContextOptionsBuilder <Project15Context>()
                          .UseInMemoryDatabase("db_eventcustomer_test_updatebyid").Options;

            // act (for act, only use the repo, to test it)
            using (var db = new Project15Context(options));

            using (var db = new Project15Context(options))
            {
                var customerRepo = new CustomerRepository(db);
                var eventRepo    = new EventRepository(db);
                var repo         = new EventCustomerRepository(db);

                Customer customer = new Customer {
                    Name = "Axel", Address1 = "111 Address"
                };
                customer = await customerRepo.CreateAsync(customer);

                await customerRepo.SaveChangesAsync();

                Event Event = new Event {
                    Name = "Jazz Fest", Type = "Music", Cost = 40
                };
                Event = await eventRepo.CreateAsync(Event);

                await eventRepo.SaveChangesAsync();

                EventCustomer eventCustomer = new EventCustomer
                {
                    CustomerId = customer.Id,
                    EventId    = Event.Id,
                    Paid       = true
                };

                eventCustomerSaved = await repo.CreateAsync(eventCustomer);

                await repo.SaveChangesAsync();

                EventSaved    = Event;
                customerSaved = customer;

                id = eventCustomerSaved.Id;
            }
            using (var db = new Project15Context(options))
            {
                var           repo          = new EventCustomerRepository(db);
                EventCustomer eventCustomer = await repo.GetByIdAsync(id);

                Assert.NotEqual(0, eventCustomer.Id); // should get some generated ID
                Assert.Equal(eventCustomerSaved.Id, eventCustomer.Id);
                Assert.Equal(EventSaved.Id, eventCustomer.EventId);

                eventCustomer.Paid = false;

                await repo.UpdateAsync(eventCustomer, id);

                await repo.SaveChangesAsync();

                eventCustomer = await repo.GetByIdAsync(eventCustomer.Id);

                Assert.NotEqual(wrongId, eventCustomer.Id); // should get some generated ID
                Assert.False(eventCustomer.Paid);
            }
        }