public async void CreatOptionAsync_ShouldAdd() { // Arrange //create in memory options var options = new DbContextOptionsBuilder <DataBaseContext>() .UseInMemoryDatabase(databaseName: "CreatOptionAsync_ShouldAdd") .Options; // Act using (var context = new DataBaseContext(options)) { var repository = new OptionRepository(context); var result = await repository.CreatOptionAsync(firstOption); // Assert Assert.Equal(firstOption, result); } using (var context = new DataBaseContext(options)) { Assert.Equal(1, await context.ProductOption.CountAsync()); } }