Exemple #1
0
        public static DB2C2PContext GetMockedDB2C2PContext(string dbName)
        {
            var options = new DbContextOptionsBuilder <DB2C2PContext>()
                          .UseInMemoryDatabase(databaseName: dbName)
                          .Options;

            /*
             * var options = new DbContextOptionsBuilder<DB2C2PContext>()
             * .UseSqlite("DataSource=:memory:")
             * //.UseSqlite("Data Source = unittest.db")
             * .Options;
             */
            var dbContext = new DB2C2PContext(options);

            //dbContext.Database.Migrate();
            dbContext.Database.EnsureCreated();
            dbContext.Seed();

            return(dbContext);
        }
Exemple #2
0
 public CustomersController(DB2C2PContext context)
 {
     _context = context;
 }