public void Initialize() { var options = new DbContextOptionsBuilder <ApplicationContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()) .Options; _applicationUnitOfWork = new ApplicationContext(options); _applicationUnitOfWork.SeedMockCustomers(); _applicationUnitOfWork.Database.EnsureCreated(); var mappingConfig = new MapperConfiguration(mc => { mc.AddProfile(new ApplicationMappingProfile()); }); IMapper mapper = mappingConfig.CreateMapper(); _customerService = new CustomerService(_applicationUnitOfWork, mapper); }