public void UpdateStockItem() { /// Read elements from list InitializeReadingTest(); StockItem updatedItem = new StockItem(3, "Ketchup", 2000, "ml", 50); /// Update stock items proportion Program.UpdateElement(stock, updatedItem, TestStockCsv); Assert.AreEqual(2000, stock.GetItemByID(3).GetPortionCount()); /// Check if writing is successful to file RestaurantStock newStock = fileInterface.ReadStockFile(TestStockCsv); Assert.AreEqual(2000, newStock.GetItemByID(3).GetPortionCount()); }
public void CreateNewOrder_Successful() { /// Read elements from list InitializeReadingTest(); OrderItem newOrder = new OrderItem(6, DateTime.Now, new List <MenuItem> { menu.GetItemByID(1) }); /// Check if items are added to array Program.AddElement(newOrder, TestOrdersCsv, TestStockCsv, stock, orders); Assert.AreEqual(6, orders.GetElementCount()); /// Check if order is existing in file RestaurantOrders newOrders = fileInterface.ReadOrdersFile(TestOrdersCsv, menu); RestaurantStock newStock = fileInterface.ReadStockFile(TestStockCsv); Assert.AreEqual(4.7, newStock.GetItemByID(2).GetPortionCount()); Assert.AreEqual(6, newOrders.GetElementCount()); }