Remove() public method

public Remove ( MenuItem item ) : void
item MenuItem
return void
示例#1
0
        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));
        }
示例#2
0
        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));
        }
示例#3
0
        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);
        }
示例#4
0
        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));
        }