private List <WpfListItem> SelectItemOnComboBox(string autoId, UITestControl theTab) { var selectedItems = new List <WpfListItem>(); WpfTable middleBox = WorkflowDesignerUIMap.AssignControl_GetSmallViewTable(theTab, autoId, 0); // Get the textbox var uiTestControlCollection = middleBox.Rows[0] .GetChildren() .SelectMany(c => c.GetChildren()) .Where(c => c.ControlType == ControlType.ComboBox) .ToList(); foreach (WpfComboBox dbDropDownControl in uiTestControlCollection) { Point pointOnDropDownControl = new Point(dbDropDownControl.BoundingRectangle.X + 25, dbDropDownControl.BoundingRectangle.Y + 5); Mouse.Click(pointOnDropDownControl); Playback.Wait(1000); // Sorted with framework ;) var comboBoxList = dbDropDownControl.Items.Select(i => i as WpfListItem).ToList(); var selectedItem = comboBoxList[1]; selectedItems.Add(selectedItem); Mouse.Click(selectedItem, new Point(5, 5)); Playback.Wait(1000); // Sorted with framework ;) } return(selectedItems); }
private bool VerifySelectedItems(string autoId, UITestControl theTab, List <WpfListItem> selectedItems) { bool isValid = false; WpfTable middleBox = WorkflowDesignerUIMap.AssignControl_GetSmallViewTable(theTab, autoId, 0); // Get the textbox var uiTestControlCollection = middleBox.Rows[0] .GetChildren() .SelectMany(c => c.GetChildren()) .Where(c => c.ControlType == ControlType.ComboBox) .ToList(); foreach (WpfComboBox dbDropDownControl in uiTestControlCollection) { isValid = selectedItems.Select(i => i.DisplayText).Contains(dbDropDownControl.SelectedItem); } return(isValid); }