本文整理汇总了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));
}
示例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);
}
示例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);
}
示例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);
}
示例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));
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}