IndexOfKey() public méthode

public IndexOfKey ( string key ) : int
key string
Résultat int
Exemple #1
0
        public void MenuItemCollection_IndexOfKey_Invoke_ReturnsExpected(string key, int expected)
        {
            var menu = new SubMenu(new MenuItem[] { new MenuItem {
                                                        Name = "name"
                                                    } });
            var collection = new Menu.MenuItemCollection(menu);

            Assert.Equal(expected, collection.IndexOfKey(key));

            // Call again to validate caching behaviour.
            Assert.Equal(expected, collection.IndexOfKey(key));
            Assert.Equal(-1, collection.IndexOfKey("noSuchKey"));
        }