当前位置: 首页>>代码示例>>C#>>正文


C# touch_for_foodEntities.Entry方法代码示例

本文整理汇总了C#中TouchForFood.Models.touch_for_foodEntities.Entry方法的典型用法代码示例。如果您正苦于以下问题:C# touch_for_foodEntities.Entry方法的具体用法?C# touch_for_foodEntities.Entry怎么用?C# touch_for_foodEntities.Entry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TouchForFood.Models.touch_for_foodEntities的用法示例。


在下文中一共展示了touch_for_foodEntities.Entry方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DeleteItemActiveExceptionTest

        public void DeleteItemActiveExceptionTest()
        {
            //Arrange
            db = new touch_for_foodEntities();
            MenuItemOM target = new MenuItemOM(db);
            menuItem1.is_active = true;
            db.Entry(menuItem1).State = EntityState.Modified;
            db.SaveChanges();

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

            //Assert
            db = new touch_for_foodEntities();
            Assert.IsFalse(db.menu_item.Find(menuItem1.id).is_deleted);
            Assert.IsNotNull(db.order_item.Find(orderItem1.id));
        }
开发者ID:pmoda,项目名称:TFFCode,代码行数:17,代码来源:MenuItemOMTest.cs

示例2: DeleteItemActiveExceptionTest

        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);
        }
开发者ID:pmoda,项目名称:TFFCode,代码行数:19,代码来源:OrderOMTest.cs

示例3: DeleteConfirmedTestItemActiveException

        public void DeleteConfirmedTestItemActiveException()
        {
            // Arrange
            db = new touch_for_foodEntities();
            Menu_ItemController target = new Menu_ItemController();
            int expectedMenuItems = db.menu_item.ToList<menu_item>().Count();
            menuItem1 = db.menu_item.Find(menuItem1.id);
            menuItem1.is_active = true;
            db.Entry(menuItem1).State = EntityState.Modified;
            db.SaveChanges();

            // Act
            var actualResult = target.DeleteConfirmed(menuItem1.id) as RedirectToRouteResult;

            // Assertions
            db = new touch_for_foodEntities();
            var actualResultURI = actualResult.RouteValues["action"];
            int actualMenuItems = db.menu_item.ToList<menu_item>().Count();

            Assert.AreEqual(expectedMenuItems, actualMenuItems);
            Assert.IsFalse(db.menu_item.Find(menuItem1.id).is_deleted);
            Assert.AreEqual("Index", actualResultURI);
        }
开发者ID:pmoda,项目名称:TFFCode,代码行数:23,代码来源:Menu_ItemControllerTest.cs

示例4: DeleteActiveWarningTest

        public void DeleteActiveWarningTest()
        {
            //Arrange
            db = new touch_for_foodEntities();
            Menu_CategoryController target = new Menu_CategoryController(db);
            menuCategory1.is_active = true;
            db.Entry(menuCategory1).State = EntityState.Modified;
            db.SaveChanges();
            menu_category expected = menuCategory1;

            //Act
            ViewResult actual = (ViewResult)target.Delete(menuCategory1.id);

            //Assert
            Assert.AreEqual(expected.id, ((menu_category)actual.ViewData.Model).id);
            Assert.IsNotNull(actual.ViewBag.Warning);
        }
开发者ID:pmoda,项目名称:TFFCode,代码行数:17,代码来源:Menu_CategoryControllerTest.cs

示例5: DeleteConfirmedTest

        public void DeleteConfirmedTest()
        {
            //Setup
            db = new touch_for_foodEntities();
            user1.current_table_id = null;
            db.Entry(user1).State = EntityState.Modified;
            db.SaveChanges();

            //CheckSetup
            Assert.IsFalse(db.restaurants.Find(restaurant1.id).is_deleted);
            Assert.IsNotNull(db.tables.Find(table1.id));
            Assert.IsNotNull(db.restaurant_user.Find(restaurantUser1.id).restaurant_id);
            Assert.IsFalse(db.menus.Find(menu1.id).is_deleted);
            Assert.IsNotNull(db.reviews.Find(review1.id));

            //Act
            var actual = target.DeleteConfirmed(restaurant1.id);

            //Assert
            db = new touch_for_foodEntities();
            Assert.IsTrue(db.restaurants.Find(restaurant1.id).is_deleted);
            Assert.IsNull(db.tables.Find(table1.id));
            Assert.IsNull(db.restaurant_user.Find(restaurantUser1.id).restaurant_id);
            Assert.IsTrue(db.menus.Find(menu1.id).is_deleted);
            Assert.IsNull(db.reviews.Find(review1.id));
        }
开发者ID:pmoda,项目名称:TFFCode,代码行数:26,代码来源:RestaurantControllerTest.cs

示例6: DeleteConfirmedTest

        public void DeleteConfirmedTest()
        {
            //Setup
            db = new touch_for_foodEntities();
            user1.current_table_id = null;
            db.Entry(user1).State = EntityState.Modified;
            db.SaveChanges();

            //CheckSetup
            Assert.IsNotNull(db.tables.Find(table1.id));
            Assert.IsNotNull(db.orders.Find(order1.id).table_id);
            Assert.IsNotNull(db.service_request.Find(request1.id).table_id);

            //Act
            var actual = target.DeleteConfirmed(table1.id);

            //Assert
            db = new touch_for_foodEntities();
            Assert.IsNull(db.tables.Find(table1.id));
            Assert.IsNull(db.service_request.Find(request1.id).table_id);
            Assert.AreEqual((request1.version + 1), db.service_request.Find(request1.id).version);
            Assert.IsNull(db.orders.Find(order1.id).table_id);
            Assert.AreEqual((order1.version + 1), db.orders.Find(order1.id).version);
        }
开发者ID:pmoda,项目名称:TFFCode,代码行数:24,代码来源:TableControllerTest.cs

示例7: RemoveMenuCategoryExceptionTest

        public void RemoveMenuCategoryExceptionTest()
        {
            //Arrange
            db = new touch_for_foodEntities();

            //populat db (order specific)
            item item1 = testDatabase.AddItem();
            menu_item menuItem1 = testDatabase.AddMenuItem(item1, menuCategory1);

            //0 rows should have been affected
            int expected = 0;

            //make menu category active
            menuCategory1.is_active = true;
            db.Entry(menuCategory1).State = EntityState.Modified;
            db.SaveChanges();

            //Act
            int actual = target.RemoveMenuCategory(menuCategory1.id);

            //Assert
            db = new touch_for_foodEntities();
            Assert.AreEqual(expected, actual);
            Assert.IsFalse(db.menu_category.Find(menuCategory1.id).is_deleted);
            Assert.IsFalse(db.menu_item.Find(menuItem1.id).is_deleted);

            //Clean-up (order specific)
            testDatabase.RemoveMenuItem(menuItem1);
            testDatabase.RemoveItem(item1);
        }
开发者ID:pmoda,项目名称:TFFCode,代码行数:30,代码来源:MenuControllerTest.cs

示例8: DeleteConfirmedActiveExceptionTest

        public void DeleteConfirmedActiveExceptionTest()
        {
            //Arrange
            db = new touch_for_foodEntities();
            item item1 = testDatabase.AddItem();
            menu_item menuItem1 = testDatabase.AddMenuItem(item1, menuCategory1);
            //make menu active
            menu1.is_active = true;
            db.Entry(menu1).State = EntityState.Modified;
            db.SaveChanges();

            //Act
            ActionResult actual = (ActionResult)target.DeleteConfirmed(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);

            //Clean-up (order specific)
            testDatabase.RemoveMenuItem(menuItem1);
            testDatabase.RemoveItem(item1);
        }
开发者ID:pmoda,项目名称:TFFCode,代码行数:24,代码来源:MenuControllerTest.cs

示例9: DeleteActiveMenuWarningTest

        public void DeleteActiveMenuWarningTest()
        {
            //Arrange
            db = new touch_for_foodEntities();
            testDatabase.RemoveMenuCategory(menuCategory1);
            menu1.is_active= true;
            db.Entry(menu1).State = EntityState.Modified;
            db.SaveChanges();

            //Act
            ViewResult actual = (ViewResult)target.Delete(menu1.id);

            //Assert
            string actualWarning = actual.ViewBag.Warning;
            Assert.IsFalse(String.IsNullOrWhiteSpace(actualWarning));
            menu actualMenu = (menu)actual.ViewData.Model;
            Assert.AreEqual(actualMenu.id, menu1.id);
        }
开发者ID:pmoda,项目名称:TFFCode,代码行数:18,代码来源:MenuControllerTest.cs


注:本文中的TouchForFood.Models.touch_for_foodEntities.Entry方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。