public IngredientRepositoryTests() { _dbContextFactory = new DbContextInMemoryFactory(nameof(IngredientRepositoryTests)); using var dbx = _dbContextFactory.Create(); dbx.Database.EnsureCreated(); _ingredientRepositorySUT = new IngredientRepository(_dbContextFactory); }
public IngredientRepositoryTests() { _dbContextFactory = new DbContextInMemoryFactory(nameof(IngredientRepositoryTests)); using (var dbx = _dbContextFactory.CreateDbContext()) { dbx.Database.EnsureCreatedAsync().GetAwaiter().GetResult(); } _ingredientRepositorySUT = new IngredientRepository(_dbContextFactory); }
public RecipeRepositoryTests(ITestOutputHelper output) { XUnitTestOutputConverter converter = new XUnitTestOutputConverter(output); Console.SetOut(converter); _dbContextFactory = new DbContextInMemoryFactory(nameof(RecipeRepositoryTests)); using CookBookDbContext dbx = _dbContextFactory.CreateDbContext(); dbx.Database.EnsureCreated(); _repositorySUT = new RecipeRepository(_dbContextFactory); }