[NUnit.Framework.Test] // [MbUnit.Framework.Test][NUnit.Framework.Test][Fact] public void ThreeResults() { const string expectedName = "name"; HasTimeoutCmdletBase cmdlet = new HasTimeoutCmdletBase(); IFakeUiElement element01 = FakeFactory.GetAutomationElementExpected( ControlType.Button, expectedName, string.Empty, string.Empty, string.Empty); IFakeUiElement element02 = FakeFactory.GetAutomationElementExpected( ControlType.Button, expectedName, string.Empty, string.Empty, string.Empty); IFakeUiElement element03 = FakeFactory.GetAutomationElementExpected( ControlType.Button, string.Empty, string.Empty, string.Empty, string.Empty); IFakeUiElement element04 = FakeFactory.GetAutomationElementExpected( ControlType.Button, expectedName, string.Empty, string.Empty, string.Empty); var controlSearcherData = new ControlSearcherData { Name = expectedName, AutomationId = string.Empty, Class = string.Empty, Value = string.Empty }; List <IUiElement> resultList = WindowSearcher.ReturnOnlyRightElements( new[] { element01, element02, element03, element04 }, controlSearcherData, false, true); MbUnit.Framework.Assert.AreEqual(3, resultList.Count); // 20140312 // MbUnit.Framework.Assert.Exists(resultList, e => e.Current.Name == expectedName); // ?? MbUnit.Framework.Assert.Exists(resultList, e => e.GetCurrent().Name == expectedName); // ?? }
/// <summary> /// 模糊查找某个窗口下的包含指定名称的子窗口 /// </summary> /// <param name="parent"></param> /// <param name="title"></param> /// <returns></returns> public static IntPtr FindWindow(IntPtr parent, String title) { WindowSearcher s = new WindowSearcher(); s.Parent = parent; s.Title = title; return(s.Find()); }
public static List <IUiElement> GetResultList_ReturnOnlyRightElements(IEnumerable <IUiElement> elements, ControlSearcherData data, bool useWildcardOrRegex) { List <IUiElement> resultList = WindowSearcher.ReturnOnlyRightElements( elements, data, false, useWildcardOrRegex); return(resultList); }
public static List <IUiElement> GetResultList_GetWindowCollectionByPid( IUiElement rootElement, WindowSearcherData data) { var windowSearcher = new WindowSearcher(); List <IUiElement> resultList = windowSearcher.GetWindowCollectionByPid( rootElement, data); return(resultList); }
[NUnit.Framework.Test] // [MbUnit.Framework.Test][NUnit.Framework.Test][Fact] public void NoResults_ZeroInput() { HasTimeoutCmdletBase cmdlet = new HasTimeoutCmdletBase(); var controlSearcherData = new ControlSearcherData { Name = string.Empty, AutomationId = string.Empty, Class = string.Empty, Value = string.Empty, ControlType = new string[] {} }; List <IUiElement> resultList = WindowSearcher.ReturnOnlyRightElements( new UiElement[] {}, controlSearcherData, false, true); MbUnit.Framework.Assert.AreEqual(0, resultList.Count); }