public void MenuItemCollection_Remove_IListNotMenuItem_Nop(object value) { var menuItem = new MenuItem(); var menu = new SubMenu(new MenuItem[] { menuItem }); IList collection = new Menu.MenuItemCollection(menu); collection.Remove(value); Assert.Equal(menuItem, Assert.Single(collection)); }
public void MenuItemCollection_Remove_NoMenuMenuItem_Nop() { var menuItem = new MenuItem(); var menu = new SubMenu(new MenuItem[] { menuItem }); var collection = new Menu.MenuItemCollection(menu); collection.Remove(new MenuItem()); Assert.Equal(menuItem, Assert.Single(collection)); }
public void MenuItemCollection_Remove_IListMenuItem_Success() { var menuItem = new MenuItem(); var menu = new SubMenu(new MenuItem[] { menuItem }); IList collection = new Menu.MenuItemCollection(menu); collection.Remove(menuItem); Assert.Empty(collection); Assert.Null(menuItem.Parent); Assert.Equal(-1, menuItem.Index); }
public void MenuItemCollection_Remove_DifferentOwnerMenuMenuItem_Nop() { var menuItem = new MenuItem(); var menu = new SubMenu(new MenuItem[] { menuItem }); var collection = new Menu.MenuItemCollection(menu); var otherMenuItem = new MenuItem(); var otherMenu = new SubMenu(new MenuItem[] { otherMenuItem }); collection.Remove(otherMenuItem); Assert.Equal(menuItem, Assert.Single(collection)); }