private static void EnsureNotepadHasExpectedMenus(AutomationElement windowElement) { var menuBar = windowElement.FindFirstDescendantById("MenuBar"); menuBar.ExecuteWithUpdatedCache( AutomationExtensions.BuildCacheRequest(TreeScope.Element | TreeScope.Children, AutomationElement.NameProperty), m => CollectionAssert.AreEqual(NotepadMenuNames, GetChildNames(m))); }
public static void Run(Arguments arguments) { if (arguments.ShowHelp) { Usage(); return; } AutomationElement.FromHandle(arguments.WindowHandle).ExecuteWithUpdatedCache(AutomationExtensions.BuildCacheRequest(TreeScope.Element | TreeScope.Descendants, AutomationElement.NameProperty), element => DumpValuesRecursive(element, 0)); }
private static void EnsureNotepadHasExpectedMenusWithHierarchicalValueProvider(AutomationElement windowElement) { var hvp = new HierarchicalValueProvider <AutomationElement, string, string>(windowElement); var menuBar = windowElement.FindFirstDescendantById("MenuBar"); menuBar.ExecuteWithUpdatedCache( AutomationExtensions.BuildCacheRequest(TreeScope.Element | TreeScope.Children, AutomationElement.NameProperty), m => { var values = hvp.GetValues(BuildNotepadMenuTree()); CollectionAssert.AreEqual(NotepadMenuNames, values["menu"]); }); }