예제 #1
0
        public void Seed(ThinkBridgeDBContext context)
        {
            context.Database.EnsureDeleted();
            context.Database.EnsureCreated();

            context.Inventory.AddRange(
                new Inventory()
            {
                Name = "candy", Description = "candycandycandy", Price = 10, Image = null
            },
                new Inventory()
            {
                Name = "biscuit", Description = "biscuitbiscuit", Price = 20, Image = null
            },
                new Inventory()
            {
                Name = "toolkit", Description = "toolkittoolkit", Price = 30, Image = null
            },
                new Inventory()
            {
                Name = "tape", Description = "tapetapetapetapetape", Price = 40, Image = null
            }
                );
            context.SaveChanges();
        }
예제 #2
0
        public UnitTestController()
        {
            var context = new ThinkBridgeDBContext(dbContextOptions);
            DummyDataDBInitializer db = new DummyDataDBInitializer();

            db.Seed(context);

            repository = new InventoryRepository(context);
        }
예제 #3
0
 public InventoryRepository(ThinkBridgeDBContext _db)
 {
     db = _db;
 }