Exemplo n.º 1
0
        public static int DeleteOrder(int o, ref List <string> errors)
        {
            if (o <= 0)
            {
                errors.Add("Invalid order id");
            }

            if (errors.Count > 0)
            {
                return(-1);
            }

            return(DALOrders.DeleteOrder(o, ref errors));
        }
Exemplo n.º 2
0
        public void DeleteOrdersTest()
        {
            List <string> errors = new List <string>();

            Orders order = new Orders();

            order.order_id     = 1;
            order.customer_id  = 1;
            order.grand_total  = 0;
            order.tax_total    = 0;
            order.subtotal     = order.grand_total + order.tax_total;
            order.date_created = new DateTime();
            order.condition    = 'a';

            int id = DALOrders.CreateOrder(order, ref errors);

            Assert.AreEqual(0, errors.Count);
            Assert.AreNotEqual(-1, id);

            int status = DALOrders.DeleteOrder(id, ref errors);

            Assert.AreEqual(0, errors.Count);
            Assert.AreEqual(1, status);
        }