public void MenuDelete_Ok() { var menu = MenuHelper.RetrieveMenus("Admin").FirstOrDefault(m => m.Category == "0"); Assert.True(MenuHelper.Delete(new string[] { menu.Id })); var menu2 = MenuHelper.RetrieveMenus("Admin").FirstOrDefault(m => m.Id == menu.Id); Assert.NotNull(menu2); // 保护模式下,正常選單可以刪除 var poco = new BootstrapMenu() { Name = "UnitTest", Application = "3", Category = "1", Icon = "fa fa-fa", IsResource = 0, Target = "_blank", Order = 10, Url = "#", ParentId = "0", ParentName = "Test", }; // insert Assert.True(MenuHelper.Save(poco)); // update poco = MenuHelper.RetrieveAllMenus("Admin").Where(m => m.Id == poco.Id).FirstOrDefault(); Assert.True(MenuHelper.Save(poco)); // clean MenuHelper.Delete(new string[] { poco.Id }); }
public void Save_Ok() { var poco = new BootstrapMenu() { Name = "UnitTest", Application = "0", Category = "0", Icon = "fa fa-fa", IsResource = 0, Target = "_blank", Order = 10, Url = "#", ParentId = "0", ParentName = "Test" }; // insert Assert.True(MenuHelper.Save(poco)); // update poco = MenuHelper.RetrieveAllMenus("Admin").Where(m => m.Id == poco.Id).FirstOrDefault(); Assert.True(MenuHelper.Save(poco)); // clean MenuHelper.Delete(new string[] { poco.Id }); }