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(); }
public UnitTestController() { var context = new ThinkBridgeDBContext(dbContextOptions); DummyDataDBInitializer db = new DummyDataDBInitializer(); db.Seed(context); repository = new InventoryRepository(context); }
public InventoryRepository(ThinkBridgeDBContext _db) { db = _db; }