Ejemplo n.º 1
0
        public void Convert_To_Database_Test()
        {
            //Setup
            var oli     = new List <OrderLineItem>();
            var ordCtrl = new OrderCtrl();
            var ordDb   = new Order();
            var order   = 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
            };

            var dt    = new DateTime(2018, 11, 08, 12, 22, 33);
            var resDt = new DateTime(2018, 11, 08, 18, 00, 00);

            var dbOrder = new DatabaseAccessLibrary.Order
            {
                id           = 1000002,
                restaurantId = 1000000,
                dateTime     = dt,
                reservation  = resDt,
                noSeats      = 2
            };

            //Act
            var resOrder = ordCtrl.ConvertOrder(order);

            //Assert
            Assert.IsTrue(resOrder.id == dbOrder.id &&
                          resOrder.restaurantId == dbOrder.restaurantId &&
                          resOrder.dateTime == dbOrder.dateTime &&
                          resOrder.reservation == dbOrder.reservation &&
                          resOrder.noSeats == dbOrder.noSeats);
        }
Ejemplo n.º 2
0
        public void Update_Order_Test()
        {
            //Setup
            var ordC = new OrderCtrl(); var ordDb = new Order();
            var dt       = new DateTime(2018, 11, 08, 12, 22, 33);
            var newResDt = new DateTime(2018, 11, 08, 19, 00, 00);

            var dbOrder = new DatabaseAccessLibrary.Order
            {
                id           = 1000000,
                restaurantId = 1000000,
                dateTime     = dt,
                reservation  = newResDt,
                noSeats      = 2,
                accepted     = false
            };

            //Act
            ordC.UpdateOrder(dbOrder);

            //Assert
            Assert.IsTrue(ordC.GetOrderById(1000000).ReservationDateTime == newResDt.ToString());
        }