コード例 #1
0
        public IngredientRepositoryTests()
        {
            _dbContextFactory = new DbContextInMemoryFactory(nameof(IngredientRepositoryTests));
            using var dbx     = _dbContextFactory.Create();
            dbx.Database.EnsureCreated();

            _ingredientRepositorySUT = new IngredientRepository(_dbContextFactory);
        }
コード例 #2
0
 public IngredientRepositoryTests()
 {
     _dbContextFactory = new DbContextInMemoryFactory(nameof(IngredientRepositoryTests));
     using (var dbx = _dbContextFactory.CreateDbContext())
     {
         dbx.Database.EnsureCreatedAsync().GetAwaiter().GetResult();
     }
     _ingredientRepositorySUT = new IngredientRepository(_dbContextFactory);
 }
コード例 #3
0
        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);
        }