public void Convert_OrderLineItem_To_Db_Test()
        {
            //Setup
            var ordC = new OrderCtrl();
            var oli  = new List <OrderLineItem>();
            var item = new ModelLibrary.Item();

            item.Id = 1000000;
            oli.Add(new OrderLineItem(item, 2));
            var mOrder = new Order
            {
                OrderId             = "1000002",
                CustomerId          = "1000000",
                RestaurantId        = "1000000",
                DateTime            = "2018-11-08 12:22:33",
                ReservationDateTime = "2018-11-08 18:00:00",
                ItemsList           = oli,
                NoSeats             = "2",
                Payment             = "200.00",
                Accepted            = false
            };

            //Act
            var dbOrd = ordC.ConvertOrderLineItemsToDb(mOrder);

            //Assert
            Assert.IsTrue(dbOrd[0].itemId == 1000000 &&
                          dbOrd[0].orderId == 1000002);
        }
        public void Add_Order_To_Database_Test()
        {
            //Setup
            var ordCtrl = new OrderCtrl();
            var ordDb   = new OrderDb();
            var dt      = new DateTime(2018, 11, 08, 12, 22, 33);
            var resDt   = new DateTime(2018, 11, 08, 18, 00, 00);
            var oli     = new List <OrderLineItem>();
            var item    = new ModelLibrary.Item();

            item.Id = 1000000;
            oli.Add(new OrderLineItem(item, 2));

            var order = new Order
            {
                OrderId             = (ordCtrl.GetLastOrderIdentity() + 1).ToString(),
                CustomerId          = "1000000",
                RestaurantId        = "1000000",
                DateTime            = "2018-11-08 12:22:33",
                ReservationDateTime = "2018-11-08 18:00:00",
                ItemsList           = oli,
                NoSeats             = "2",
                Payment             = "200.00",
                Accepted            = false
            };

            //Act
            var oliList = ordCtrl.ConvertOrderLineItemsToDb(order);
            var dbOrder = ordCtrl.ConvertOrder(order);

            for (var i = 0; i < dbOrder.OrderLineItems.Count - 1; i++)
            {
                dbOrder.OrderLineItems.Add(oliList[i]);
            }
            ordDb.AddOrder(dbOrder);

            //Assert
            Assert.IsTrue(ordCtrl.GetLastOrderIdentity() == Convert.ToInt32(order.OrderId));
        }