Example #1
0
        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);
        }
Example #2
0
        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);
        }
Example #3
0
        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);
        }
Example #4
0
        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);
        }
Example #5
0
        public ActionResult Index()
        {
            List <TableOrder> allOrders = TableOrder.GetAll();

            return(View(allOrders));
        }