public static async Task <Address> AddDummyAddressAsync(ApplicationContext context) { var uuid = Guid.NewGuid(); var address = AddressFixture.GetDummyAddress(uuid); await context.Addresses.AddAsync(address); await context.SaveChangesAsync(); context.ChangeTracker.Clear(); return(address); }
public static async Task <Customer> AddDummyCustomerAsync(ApplicationContext context, string email = "") { var emailToRegister = string.IsNullOrEmpty(email) ? Guid.NewGuid().ToString() : email; var customer = CustomerFixture.GetDummyCustomer(Guid.NewGuid(), emailToRegister); var address = AddressFixture.GetDummyAddress(Guid.NewGuid()); customer.Addresses = new[] { address }; await context.Customers.AddAsync(customer); await context.SaveChangesAsync(); context.ChangeTracker.Clear(); return(customer); }