public void GetWarehouseFailDb() { var warehouseDb = new DbWarehouse(); var rw = warehouseDb.GetWarehouse(0); Assert.IsNull(rw); }
public void UpdateWarehouseDb() { var warehouseDb = new DbWarehouse(); var prod = new Product { Id = 1, Category = "category", Description = "ddeskr", Name = "banan", Price = 10 }; var shop = new Shop { Name = "ShopName", Address = "new addr", OpeningTime = "Manday Never", Chain = new DbChain().GetChain(1), Cvr = "12121212", Warehouses = new List <Warehouse>() }; var shopId = new DbShop().AddShop(shop); shop.Id = shopId; var warehouseToUpdate = new Warehouse(1, 1, prod, shop, null); var id = warehouseDb.AddWarehouse(warehouseToUpdate); warehouseToUpdate.Id = id; var warehouseNew = new Warehouse(id, 100, 50, prod, shop, 1); warehouseDb.UpdateWarehouse(warehouseNew); var updatedWarehouse = warehouseDb.GetWarehouse(id); Assert.AreEqual(warehouseNew.Stock, updatedWarehouse.Stock); }
public void GetWarehouseDb() { var warehouseDb = new DbWarehouse(); var prod = new Product { Id = 1, Category = "category", Description = "ddeskr", Name = "banan", Price = 10 }; var shop = new Shop { Name = "ShopName", Address = "new addr", OpeningTime = "Manday Never", Chain = new DbChain().GetChain(1), Cvr = "12121212", Warehouses = new List <Warehouse>() }; var shopId = new DbShop().AddShop(shop); shop.Id = shopId; var warehouse = new Warehouse(10, 5, prod, shop, 1); var id = warehouseDb.AddWarehouse(warehouse); var rw = warehouseDb.GetWarehouse(id); Assert.IsNotNull(rw); }