[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); // ??
        }
Example #2
0
        public static List <IUiElement> GetResultList_ReturnOnlyRightElements(IEnumerable <IUiElement> elements, ControlSearcherData data, bool useWildcardOrRegex)
        {
            List <IUiElement> resultList =
                WindowSearcher.ReturnOnlyRightElements(
                    elements,
                    data,
                    false,
                    useWildcardOrRegex);

            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);
        }