public async Task CreateAsyncWorksCorrectly() { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()).Options; var dbContext = new ApplicationDbContext(options); var addressesService = new Mock <IAddressesService>(); var repository = new EfDeletableEntityRepository <City>(dbContext); var service = new CitiesService(repository, addressesService.Object); await service.CreateAsync("1", 1); var result = dbContext.Cities.FirstOrDefault(c => c.Name == "1"); Assert.NotNull(result); }