private List <AutomationElement> GetRowElements() { List <AutomationElement> descendants = automationElementFinder.Descendants(AutomationSearchCondition.ByControlType(ControlType.Custom)); var automationElements = new BricksCollection <AutomationElement>(descendants); return(automationElements.FindAll(rowPredicate)); }
private void CreateConfiguration(Dictionary<string, object> defaultValues, NameValueCollection nameValues) { foreach (KeyValuePair<string, object> pair in defaultValues) usedValues.Add(pair.Key, pair.Value.ToString()); foreach (string key in nameValues.AllKeys) { string value = nameValues.Get(key); if (value != null) { usedValues.Remove(key); usedValues[key] = value; } } var allKeys = new BricksCollection<string>(nameValues.AllKeys); allKeys.AddRange(defaultValues.Keys); foreach (string key in allKeys) { string value = ConfigurationManager.AppSettings[key]; if (value != null) { usedValues.Remove(key); usedValues[key] = value; } } }
public void AllUIItemsHaveDefaultConstructor() { var collection = new BricksCollection<Class>(); AllSubsclassesHaveEmptyConstructor(collection, typeof (UIItem)); AllSubsclassesHaveEmptyConstructor(collection, typeof (SearchCondition)); AllSubsclassesHaveEmptyConstructor(collection, typeof (SearchCriteria)); AllSubsclassesHaveEmptyConstructor(collection, typeof (AutomationElementProperty)); }
public void AllUIItemsHaveDefaultConstructor() { var collection = new BricksCollection <Class>(); AllSubsclassesHaveEmptyConstructor(collection, typeof(UIItem)); AllSubsclassesHaveEmptyConstructor(collection, typeof(SearchCondition)); AllSubsclassesHaveEmptyConstructor(collection, typeof(SearchCriteria)); AllSubsclassesHaveEmptyConstructor(collection, typeof(AutomationElementProperty)); }
public virtual List <Window> DesktopWindows(Process process, ApplicationSession applicationSession) { BricksCollection <AutomationElement> collection = FindAllWindowElements(process); var list = new List <Window>(); foreach (AutomationElement automationElement in collection) { InitializeOption initializeOption = InitializeOption.NoCache; list.Add(Create(automationElement, initializeOption, applicationSession.WindowSession(initializeOption))); } return(list); }
private void AllSubsclassesHaveEmptyConstructor(BricksCollection<Class> collection, Type type) { var @class = new Class(type); Classes classes = @class.SubClassesInAssembly(); foreach (Class subClass in classes) { bool hasDefaultConstructor = false; subClass.EachConstructor(delegate(ConstructorInfo constructorInfo) { if (constructorInfo.GetParameters().Length == 0 || subClass.Name.Equals(typeof(ToggleableItem).Name)) hasDefaultConstructor = true; }); if (!hasDefaultConstructor && subClass.ClassType.IsVisible && !subClass.Name.Equals("Desktop")) collection.Add(subClass); } Assert.AreEqual(0, collection.Count, collection.ToString()); }
private BricksCollection <AutomationElement> FindAllWindowElements(Process process) { var clock = new Clock(CoreAppXmlConfiguration.Instance.UIAutomationZeroWindowBugTimeout, 200); Clock.Do @do = delegate { var windowElements = new BricksCollection <AutomationElement>(); FindDescendantWindowElements(finder, process, windowElements); if (windowElements.Count == 0) { WhiteLogger.Instance.Warn("Could not find any windows for this application."); } return(windowElements); }; Clock.Matched matched = obj => ((BricksCollection <AutomationElement>)obj).Count > 0; Clock.Expired expired = () => new BricksCollection <AutomationElement>(); return((BricksCollection <AutomationElement>)clock.Perform(@do, matched, expired)); }
private AutomationElement FindWindowElement(Process process, Predicate <string> match) { BricksCollection <AutomationElement> elements = FindAllWindowElements(process); return(elements.Find(delegate(AutomationElement obj) { if (match.Invoke(obj.Current.Name)) { return true; } AutomationElement titleBarElement = new AutomationElementFinder(obj).Child(AutomationSearchCondition.ByControlType(ControlType.TitleBar)); if (titleBarElement == null) { return false; } return match.Invoke(titleBarElement.Current.Name); })); }
private void AllSubsclassesHaveEmptyConstructor(BricksCollection <Class> collection, Type type) { var @class = new Class(type); Classes classes = @class.SubClassesInAssembly(); foreach (Class subClass in classes) { bool hasDefaultConstructor = false; subClass.EachConstructor(delegate(ConstructorInfo constructorInfo) { if (constructorInfo.GetParameters().Length == 0 || subClass.Name.Equals(typeof(ToggleableItem).Name)) { hasDefaultConstructor = true; } }); if (!hasDefaultConstructor && subClass.ClassType.IsVisible && !subClass.Name.Equals("Desktop")) { collection.Add(subClass); } } Assert.AreEqual(0, collection.Count, collection.ToString()); }
private void FindDescendantWindowElements(AutomationElementFinder windowFinder, Process process, BricksCollection<AutomationElement> windowElements) { List<AutomationElement> children = windowFinder.Children(AutomationSearchCondition.ByControlType(ControlType.Window).WithProcessId(process.Id)); windowElements.AddRange(children); foreach (AutomationElement automationElement in children) FindDescendantWindowElements(new AutomationElementFinder(automationElement), process, windowElements); }
private BricksCollection<AutomationElement> FindAllWindowElements(Process process) { var clock = new Clock(CoreAppXmlConfiguration.Instance.UIAutomationZeroWindowBugTimeout, 200); Clock.Do @do = delegate { var windowElements = new BricksCollection<AutomationElement>(); FindDescendantWindowElements(finder, process, windowElements); if (windowElements.Count == 0) WhiteLogger.Instance.Warn("Could not find any windows for this application."); return windowElements; }; Clock.Matched matched = obj => ((BricksCollection<AutomationElement>) obj).Count > 0; Clock.Expired expired = () => new BricksCollection<AutomationElement>(); return (BricksCollection<AutomationElement>) clock.Perform(@do, matched, expired); }
public virtual void SetTestLessProjectReferences(BricksCollection<VisualStudioProject> projects) { List<XmlNode> itemGroups = XML.MatchingNodes(xmlDocument, "ItemGroup", obj => obj.ChildNodes.Count != 0 && obj.ChildNodes[0].Name.Equals("ProjectReference")); if (itemGroups.Count == 0) return; foreach (XmlNode node in itemGroups[0].ChildNodes) { foreach (VisualStudioProject project in projects) { XmlAttribute includeAttribute = node.Attributes["Include"]; if (includeAttribute.Value.Contains(project.ProjectName.Name)) { includeAttribute.Value = includeAttribute.Value.Replace(project.ProjectName.WithExtension, project.ProjectName.TestLessName.WithExtension); } } } Save(); }
public virtual void SetTestLessProjectReferences(BricksCollection<VisualStudioProject> projects) { }
private void FindDescendantWindowElements(AutomationElementFinder windowFinder, Process process, BricksCollection <AutomationElement> windowElements) { List <AutomationElement> children = windowFinder.Children(AutomationSearchCondition.ByControlType(ControlType.Window).WithProcessId(process.Id)); windowElements.AddRange(children); foreach (AutomationElement automationElement in children) { FindDescendantWindowElements(new AutomationElementFinder(automationElement), process, windowElements); } }
private List<AutomationElement> GetRowElements() { List<AutomationElement> descendants = automationElementFinder.Descendants(AutomationSearchCondition.ByControlType(ControlType.Custom)); var automationElements = new BricksCollection<AutomationElement>(descendants); return automationElements.FindAll(RowPredicate); }