Exemplo n.º 1
0
        public OrderTests()
        {
            var storeContextFactory = new StoreContextFactory();

            SampleDataInitializer.InitializeData(storeContextFactory.CreateDbContext(new string[0]));
            _db = storeContextFactory.CreateDbContext(new string[0]);
        }
Exemplo n.º 2
0
        public void SetupDb()
        {
            try
            {
                //todo create db for testing

                var context = _contextFactory.CreateDbContext(null);
                context.Database.Migrate();
                SeedData.Initialize(context);
            }
            catch (Exception)
            {
                throw new Exception("Cannot initialize database.");
            }
        }
Exemplo n.º 3
0
 private static void InitializeDb(IWebHost host)
 {
     try
     {
         var storeContextFactory = new StoreContextFactory();
         var context             = storeContextFactory.CreateDbContext(null);
         context.Database.Migrate();
         SeedData.Initialize(context);
     }
     catch (Exception)
     {
         throw new Exception("Cannot initialize database.");
     }
 }