public void VerifyClosed() { var dialog = DialogHelpers.FindDialog(GetMainWindowHWnd(), GenerateTypeDialogID, isOpen: false); if (dialog != null) { throw new InvalidOperationException($"Expected the '{GenerateTypeDialogID}' dialog to be closed but it is not."); } }
public void SelectParameter(string parameterName) { var dialogAutomationElement = DialogHelpers.FindDialog(GetMainWindowHWnd(), ChangeSignatureDialogAutomationId, isOpen: true); Condition propertyCondition = new PropertyCondition(AutomationElement.AutomationIdProperty, "MemberSelectionList"); var grid = dialogAutomationElement.FindFirst(TreeScope.Descendants, propertyCondition); var gridPattern = grid.GetCurrentPattern(GridPattern.Pattern) as GridPattern; var rowCount = (int)grid.GetCurrentPropertyValue(GridPattern.RowCountProperty); var columnToSelect = 2; int i = 0; for (; i < rowCount; i++) { // Modifier | Type | Parameter | Default var item = gridPattern.GetItem(i, columnToSelect); var name = item.GetCurrentPropertyValue(AutomationElement.NameProperty) as string; if (name == parameterName) { // The parent of a cell is of DataItem control type, which support SelectionItemPattern. TreeWalker walker = TreeWalker.ControlViewWalker; var parent = walker.GetParent(item); object pattern; if (parent.TryGetCurrentPattern(SelectionItemPattern.Pattern, out pattern)) { (pattern as SelectionItemPattern).Select(); } else { Assert.True(false, "Unexpected error. Item's parent is expected to support SelectionItemPattern."); } return; } } if (i == rowCount) { Assert.True(false, $"Unable to find the parameter {parameterName}"); } }
public static AutomationElement GetDialog(this AbstractIntegrationTest test, string dialogAutomationId) { var dialog = DialogHelpers.FindDialog(test.VisualStudio.Instance.Shell.GetHWnd(), dialogAutomationId, isOpen: true); return(dialog); }
public void VerifyClosed() { // FindDialog will wait until the dialog is closed, so the return value is unused. DialogHelpers.FindDialog(GetMainWindowHWnd(), ChangeSignatureDialogAutomationId, isOpen: false); }