protected ChoiceBase FindControlById(string type, string id) { ChoiceGroup group = FindControlGroupById(type, id); Assert.IsNotNull(group, "could not get the ControlGroup"); // note that this could either be what we think of as a menu, or as an item. They have the same class in windows.forms return((ChoiceBase)group.FindById(id)); }
protected void CheckSubMenuCount(string menuId, string subMenuId, int expectedCount) { Application.DoEvents(); ChoiceGroup menuGroup = FindControlGroupById("menu", menuId); MenuItem menu = (MenuItem)menuGroup.ReferenceWidget; //this is needed to populate the menu menu.PerformClick(); ChoiceGroup group = (ChoiceGroup)menuGroup.FindById(subMenuId); MenuItem submenu = (MenuItem)group.ReferenceWidget; //this is needed to populate the menu submenu.PerformClick(); Assert.AreEqual(expectedCount, submenu.MenuItems.Count); }