public void RemoveInventoryItem() { var fakeInventoryRepository = new FakeInventoryRepository(); var fridge = new FridgeService(fakeInventoryRepository); Assert.AreEqual(-5, fridge.TakeItemFromFridge(inventoryName, 5)); }
public void RemoveExistingInventoryItem() { var invItem1 = "Meatballs"; var invItem2 = "Potato"; var invItem3 = "Pasta"; var fakeInventoryRepository = new FakeInventoryRepository(); var fridge = new FridgeService(fakeInventoryRepository); var inventoryItem = new InventoryItem(invItem1, 10); fridge.AddIngredientToFridge(inventoryItem); inventoryItem = new InventoryItem(invItem2, 50); fridge.AddIngredientToFridge(inventoryItem); inventoryItem = new InventoryItem(invItem3, 4); fridge.AddIngredientToFridge(inventoryItem); Assert.AreEqual(20, fridge.TakeItemFromFridge(invItem2, 30)); Assert.AreEqual(-10, fridge.TakeItemFromFridge(invItem2, 30)); }
public void RemoveNonExistingInventoryItem() { var invItem1 = "Meatballs"; var invItem2 = "Potato"; var invRemoveItem = "Sauce"; var fakeInventoryRepository = new FakeInventoryRepository(); var fridge = new FridgeService(fakeInventoryRepository); var inventoryItem = new InventoryItem(invItem1, 10); fridge.AddIngredientToFridge(inventoryItem); inventoryItem = new InventoryItem(invItem2, 50); fridge.AddIngredientToFridge(inventoryItem); Assert.AreEqual(-5, fridge.TakeItemFromFridge(invRemoveItem, 5)); }
public double Delete(string name, double quantity) { return(_fridgeService.TakeItemFromFridge(name, quantity)); }