public void Save_SavesOrderToDatabase_Order() { string tableNumber = "4"; DateTime orderDate = new DateTime(2019, 3, 12); TableOrder newOrder = new TableOrder(tableNumber, orderDate); newOrder.Save(); TableOrder testOrder = TableOrder.GetAll()[0]; Assert.AreEqual(newOrder, testOrder); }
public void Delete_DeletesOrderFromDatabase_EmptyList() { string tableNumber = "4"; DateTime orderDate = new DateTime(2019, 3, 12); TableOrder newOrder = new TableOrder(tableNumber, orderDate); newOrder.Save(); newOrder.Delete(); List <TableOrder> testList = new List <TableOrder> { }; List <TableOrder> result = TableOrder.GetAll(); CollectionAssert.AreEqual(testList, result); }
public void Edit_EditsOrderInDatabase_Order() { string tableNumber = "4"; DateTime orderDate = new DateTime(2019, 3, 12); TableOrder newOrder = new TableOrder(tableNumber, orderDate); newOrder.Save(); string newTableNumber = "5"; DateTime newOrderDate = new DateTime(2019, 3, 5); newOrder.Edit(newTableNumber, newOrderDate); TableOrder testOrder = TableOrder.GetAll()[0]; Assert.AreEqual(newOrder, testOrder); }
public void GetAll_ReturnsAllOrdersFromDatabase_OrderList() { string firstTableNumber = "4"; DateTime firstOrderDate = new DateTime(2019, 3, 12); TableOrder firstOrder = new TableOrder(firstTableNumber, firstOrderDate); firstOrder.Save(); string secondTableNumber = "5"; DateTime secondOrderDate = new DateTime(2019, 3, 12); TableOrder secondOrder = new TableOrder(secondTableNumber, secondOrderDate); secondOrder.Save(); List <TableOrder> testList = new List <TableOrder> { firstOrder, secondOrder }; List <TableOrder> result = TableOrder.GetAll(); CollectionAssert.AreEqual(testList, result); }
public ActionResult Index() { List <TableOrder> allOrders = TableOrder.GetAll(); return(View(allOrders)); }