Ejemplo n.º 1
0
        public void DeleteItemActiveExceptionTest()
        {
            //Arrange
            db = new touch_for_foodEntities();
            OrderOM target = new OrderOM(db);
            orderItem1.order_item_status = (int)OrderStatusHelper.OrderItemStatusEnum.PROCESSING;
            db.Entry(orderItem1).State = EntityState.Modified;
            db.SaveChanges();

            //Act
            int actual = target.delete(order1.id);

            //Assert
            db = new touch_for_foodEntities();
            Assert.IsFalse(db.orders.Find(order1.id).order_status ==
                (int)OrderStatusHelper.OrderStatusEnum.DELETED);
            Assert.IsFalse(db.order_item.Find(orderItem1.id).order_item_status ==
                (int)OrderStatusHelper.OrderItemStatusEnum.DELETED);
        }
Ejemplo n.º 2
0
        public void DeleteTest()
        {
            //Arrange
            db = new touch_for_foodEntities();
            OrderOM target = new OrderOM(db);
            int expected = 2;
            int version = order1.version;
            //Check-Setup
            Assert.IsFalse(db.orders.Find(order1.id).order_status ==
                (int)OrderStatusHelper.OrderStatusEnum.DELETED);
            Assert.IsFalse(db.order_item.Find(orderItem1.id).order_item_status ==
                (int)OrderStatusHelper.OrderItemStatusEnum.DELETED);

            //Act
            int actual = target.delete(order1.id);

            //Assert
            db = new touch_for_foodEntities();
            order o = db.orders.Find(order1.id);
            Assert.IsTrue(o.order_status ==
                (int)OrderStatusHelper.OrderStatusEnum.DELETED);
            Assert.AreEqual(o.version, ++version);
            Assert.IsTrue(db.order_item.Find(orderItem1.id).order_item_status ==
                (int)OrderStatusHelper.OrderItemStatusEnum.DELETED);
            Assert.AreEqual(expected, actual);
        }