private void deleteToolStripMenuItem_Click(object sender, EventArgs e) { DialogResult dr = MessageBox.Show("Are you sure to delete \"" + this.MenuItem.Name + "\"", "Confirm", MessageBoxButtons.YesNo); if (dr == DialogResult.Yes) { MenuItemBLL menuItemBLL = new MenuItemBLL(); menuItemBLL.Delete(this.MenuItem); // fire event if (this.OnDelete != null) { this.OnDelete(this.MenuItem); } } }
public void TestDeleteMenuItem(MenuItem menuItemNew) { bool isDelete = true; menuItemBLL.Delete(menuItemNew); List <Menu> menus = menuBLL.ListMenu(); List <MenuItem> menuItems = menuItemBLL.FindByMenuID(menus[0]); for (int i = 0; i < menuItems.Count; i++) { if (menuItems[i].ID == menuItemNew.ID) { isDelete = false; } } Assert.AreEqual(isDelete, true); }