示例#1
0
        public void DeleteItemActiveExceptionTest()
        {
            //Arrange
            db = new touch_for_foodEntities();
            MenuOM target = new MenuOM(db);
            menu1.is_active = true;
            db.Entry(menu1).State = EntityState.Modified;
            db.SaveChanges();

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

            //Assert
            db = new touch_for_foodEntities();
            Assert.IsFalse(db.menus.Find(menu1.id).is_deleted);
            Assert.IsFalse(db.menu_category.Find(menuCategory1.id).is_deleted);
            Assert.IsFalse(db.menu_item.Find(menuItem1.id).is_deleted);
            Assert.IsNotNull(db.order_item.Find(orderItem1.id));
        }
示例#2
0
 private void clearMenus(ICollection<menu> menus)
 {
     MenuOM om = new MenuOM(db);
     foreach (menu m in menus)
     {
         m.is_active = false;
         om.delete(m.id);
     }
 }
示例#3
0
        public void DeleteTest()
        {
            //Arrange
            db = new touch_for_foodEntities();
            MenuOM target = new MenuOM(db);
            int currentVersion = menu1.version;
            //Check-Setup
            Assert.IsFalse(db.menus.Find(menu1.id).is_deleted);
            Assert.IsFalse(db.menu_category.Find(menuCategory1.id).is_deleted);
            Assert.IsFalse(db.menu_item.Find(menuItem1.id).is_deleted);

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

            //Assert
            db = new touch_for_foodEntities();
            menu newMenu = db.menus.Find(menu1.id);
            Assert.IsTrue(newMenu.is_deleted);
            Assert.AreEqual(newMenu.version, ++currentVersion);
            Assert.IsTrue(db.menu_category.Find(menuCategory1.id).is_deleted);
            Assert.IsTrue(db.menu_item.Find(menuItem1.id).is_deleted);
        }
示例#4
0
 public MenuController()
 {
     im = new MenuIM(db);
     om = new MenuOM(db);
 }