コード例 #1
0
        [NUnit.Framework.Test] // [MbUnit.Framework.Test][NUnit.Framework.Test][Fact]
        public void ThreeCriteria_ThreeElements_NoMatch_NameAutomaitonIdClassName()
        {
            // Arrange
            var hashtable = new Hashtable();

            hashtable.Add("NAME", "*aaa*");
            hashtable.Add("AUTOMATIONID", "*id*");
            hashtable.Add("CLASS", "cl*ss");

            // Act
            bool result = RealCodeCaller.GetResult_IsStepActive(
                new Hashtable[] {
                hashtable
            },
                AutomationFactory.GetUiEltCollection(
                    new[] {
                FakeFactory.GetAutomationElementExpected(ControlType.Button, "aa1aa", "auId", "clas", string.Empty),
                FakeFactory.GetAutomationElementExpected(ControlType.Button, "aa2aa3aa", "Id", "cl____s", string.Empty),
                FakeFactory.GetAutomationElementExpected(ControlType.Button, "a4a5abbb", "iDrweqrqw", @"/ss", string.Empty)
            })
                );

            // Assert
            MbUnit.Framework.Assert.AreEqual(false, result);
            Assert.Equal(false, result);
        }
コード例 #2
0
        private void TestParametersAgainstCollection(
            string containsText,
            string[] controlTypeNames,
            IEnumerable <IUiElement> collection,
            IEnumerable <int> handles,
            int expectedNumberOfElements)
        {
            // Act
            var resultList = RealCodeCaller.SearchByContainsTextViaWin32(FakeFactory.GetAutomationElementNotExpected(null, string.Empty, string.Empty, string.Empty, string.Empty), containsText, controlTypeNames, collection, handles);

            // Assert
            MbUnit.Framework.Assert.Count(expectedNumberOfElements, resultList);
            Assert.Equal(expectedNumberOfElements, resultList.Count);
        }
コード例 #3
0
        [NUnit.Framework.Test] // [MbUnit.Framework.Test][NUnit.Framework.Test][Fact]
        public void NoneCriteria_NoneElements()
        {
            // Arrange

            // Act
            bool result = RealCodeCaller.GetResult_IsStepActive(
                new Hashtable[] {
                null
            },
                AutomationFactory.GetUiEltCollection(new IUiElement[] { null })
                );

            // Assert
            MbUnit.Framework.Assert.AreEqual(false, result);
            Assert.Equal(false, result);
        }
コード例 #4
0
        [NUnit.Framework.Test] // [MbUnit.Framework.Test][NUnit.Framework.Test][Fact]
        public void NoneCriteria_OneElement()
        {
            // Arrange
            var element = FakeFactory.GetAutomationElementExpected(ControlType.Button, "aaaa", string.Empty, string.Empty, string.Empty);

            // Act
            bool result = RealCodeCaller.GetResult_IsStepActive(
                new Hashtable[] {
                null
            },
                AutomationFactory.GetUiEltCollection(new[] { element })
                );

            // Assert
            MbUnit.Framework.Assert.AreEqual(false, result);
            Assert.Equal(false, result);
        }
コード例 #5
0
        private void TestParametersAgainstCollection(
            string containsText,
            string[] controlTypeNames,
            IEnumerable <IUiElement> collection,
            IEnumerable <int> handles,
            int expectedNumberOfElements)
        {
            // Act
            var resultList = RealCodeCaller.Win32Gateway_GetElements_WithControlSearcherDataInput(
                FakeFactory.GetAutomationElement(ControlType.Button, string.Empty, string.Empty, string.Empty, new IBasePattern[] {}, true),
                collection.ToArray(),
                handles,
                containsText);

            // Assert
            MbUnit.Framework.Assert.Count(expectedNumberOfElements, resultList);
            Assert.Equal(expectedNumberOfElements, resultList.Count);
        }
コード例 #6
0
        [NUnit.Framework.Test] // [MbUnit.Framework.Test][NUnit.Framework.Test][Fact]
        public void OneCriterion_NoneElements()
        {
            // Arrange
            var hashtable = new Hashtable();

            hashtable.Add("NAME", "*aaa*");

            // Act
            bool result = RealCodeCaller.GetResult_IsStepActive(
                new Hashtable[] {
                hashtable
            },
                AutomationFactory.GetUiEltCollection(new IUiElement[] { null })
                );

            // Assert
            MbUnit.Framework.Assert.AreEqual(false, result);
            Assert.Equal(false, result);
        }
コード例 #7
0
        [NUnit.Framework.Test] // [MbUnit.Framework.Test][NUnit.Framework.Test][Fact]
        public void OneCriterion_OneElement_NoMatch_ClassName()
        {
            // Arrange
            var hashtable = new Hashtable();

            hashtable.Add("class", "*aaa*");
            var element = FakeFactory.GetAutomationElementExpected(ControlType.Button, string.Empty, string.Empty, "bbbb", string.Empty);

            // Act
            bool result = RealCodeCaller.GetResult_IsStepActive(
                new Hashtable[] {
                hashtable
            },
                AutomationFactory.GetUiEltCollection(new[] { element })
                );

            // Assert
            MbUnit.Framework.Assert.AreEqual(false, result);
            Assert.Equal(false, result);
        }
コード例 #8
0
        [NUnit.Framework.Test] // [MbUnit.Framework.Test][NUnit.Framework.Test][Fact]
        public void ThreeCriteria_OneElement_Match_NameAutomationIdClassName()
        {
            // Arrange
            var hashtable = new Hashtable();

            hashtable.Add("NAME", "*aaa*");
            hashtable.Add("AUTOMATIONID", "*id*");
            hashtable.Add("CLASS", "cl*ss");
            var element = FakeFactory.GetAutomationElementExpected(ControlType.Button, "aaaa", "auId", "class", string.Empty);

            // Act
            bool result = RealCodeCaller.GetResult_IsStepActive(
                new Hashtable[] {
                hashtable
            },
                AutomationFactory.GetUiEltCollection(new[] { element })
                );

            // Assert
            MbUnit.Framework.Assert.AreEqual(true, result);
            Assert.Equal(true, result);
        }
コード例 #9
0
        [NUnit.Framework.Test] // [MbUnit.Framework.Test][NUnit.Framework.Test][Fact]
        public void OneCriterion_ThreeElements_NoMatch_Name()
        {
            // Arrange
            var hashtable = new Hashtable();

            hashtable.Add("NAME", "*aaa*");

            // Act
            bool result = RealCodeCaller.GetResult_IsStepActive(
                new Hashtable[] {
                hashtable
            },
                AutomationFactory.GetUiEltCollection(new[] {
                FakeFactory.GetAutomationElementExpected(ControlType.Button, "bbbb", string.Empty, string.Empty, string.Empty),
                FakeFactory.GetAutomationElementExpected(ControlType.Edit, "bbbb", string.Empty, string.Empty, string.Empty),
                FakeFactory.GetAutomationElementExpected(ControlType.TreeItem, "bbbb", string.Empty, string.Empty, string.Empty)
            })
                );

            // Assert
            MbUnit.Framework.Assert.AreEqual(false, result);
            Assert.Equal(false, result);
        }
コード例 #10
0
        private void TestParametersAgainstCollection(
            ControlType controlType,
            string name,
            string automationId,
            string className,
            string txtValue,
            IEnumerable <IUiElement> collection,
            UsualWildcardRegex selector,
            int expectedNumberOfElements)
        {
            // Arrange
            ControlType[] controlTypes =
                new[] { controlType };

            GetControlCmdletBase cmdlet =
                FakeFactory.Get_GetControlCmdletBase(controlTypes, name, automationId, className, txtValue);

            var data =
                new ControlSearcherData {
                ControlType  = controlTypes.ConvertControlTypeToStringArray(),
                Name         = name,
                AutomationId = automationId,
                Class        = className,
                Value        = txtValue
            };

            Condition condition;
            bool      useWildcardOrRegex = true;

            switch (selector)
            {
            case UsualWildcardRegex.Wildcard:
                condition =
                    ControlSearcher.GetWildcardSearchCondition(
                        data);
                useWildcardOrRegex = true;
                break;

            case UsualWildcardRegex.Regex:
                condition =
                    ControlSearcher.GetWildcardSearchCondition(
                        data);
                useWildcardOrRegex = false;
                break;
            }

            // Act
            var resultList = RealCodeCaller.GetResultList_ReturnOnlyRightElements(collection.ToArray(), data, useWildcardOrRegex);

            // Assert
            MbUnit.Framework.Assert.Count(expectedNumberOfElements, resultList);
            Assert.Equal(expectedNumberOfElements, resultList.Count);
            string[] controlTypeNames;
            switch (selector)
            {
            case UsualWildcardRegex.Wildcard:
                const WildcardOptions options = WildcardOptions.IgnoreCase;
                // 20140312
//                    WildcardPattern namePattern = new WildcardPattern(name, options);
//                    WildcardPattern automationIdPattern = new WildcardPattern(automationId, options);
//                    WildcardPattern classNamePattern = new WildcardPattern(className, options);
//                    WildcardPattern txtValuePattern = new WildcardPattern(txtValue, options);
                var namePattern         = new WildcardPattern(name, options);
                var automationIdPattern = new WildcardPattern(automationId, options);
                var classNamePattern    = new WildcardPattern(className, options);
                var txtValuePattern     = new WildcardPattern(txtValue, options);

                // 20140312
//                    if (!string.IsNullOrEmpty(name)) {
//                        MbUnit.Framework.Assert.ForAll(resultList.Cast<IUiElement>().ToList<IUiElement>(), x => namePattern.IsMatch(x.Current.Name));
//                        resultList.All(x => namePattern.IsMatch(x.Current.Name));
//                    }
//                    if (!string.IsNullOrEmpty(automationId)) {
//                        MbUnit.Framework.Assert.ForAll(resultList.Cast<IUiElement>().ToList<IUiElement>(), x => automationIdPattern.IsMatch(x.Current.AutomationId));
//                        resultList.All(x => automationIdPattern.IsMatch(x.Current.AutomationId));
//                    }
//                    if (!string.IsNullOrEmpty(className)) {
//                        MbUnit.Framework.Assert.ForAll(resultList.Cast<IUiElement>().ToList<IUiElement>(), x => classNamePattern.IsMatch(x.Current.ClassName));
//                        resultList.All(x => classNamePattern.IsMatch(x.Current.ClassName));
//                    }
//                    controlTypeNames =
//                        controlTypes.Select(ct => null != ct ? ct.ProgrammaticName.Substring(12) : string.Empty).ToArray();
//                    if (null != controlType) {
//                        MbUnit.Framework.Assert.ForAll(resultList.Cast<IUiElement>().ToList<IUiElement>(), x => controlTypeNames.Contains(x.Current.ControlType.ProgrammaticName.Substring(12)));
//                        resultList.All(x => controlTypeNames.Contains(x.Current.ControlType.ProgrammaticName.Substring(12)));
//                    }
                if (!string.IsNullOrEmpty(name))
                {
                    MbUnit.Framework.Assert.ForAll(resultList.Cast <IUiElement>().ToList <IUiElement>(), x => namePattern.IsMatch(x.GetCurrent().Name));
                    resultList.All(x => namePattern.IsMatch(x.GetCurrent().Name));
                }
                if (!string.IsNullOrEmpty(automationId))
                {
                    MbUnit.Framework.Assert.ForAll(resultList.Cast <IUiElement>().ToList <IUiElement>(), x => automationIdPattern.IsMatch(x.GetCurrent().AutomationId));
                    resultList.All(x => automationIdPattern.IsMatch(x.GetCurrent().AutomationId));
                }
                if (!string.IsNullOrEmpty(className))
                {
                    MbUnit.Framework.Assert.ForAll(resultList.Cast <IUiElement>().ToList <IUiElement>(), x => classNamePattern.IsMatch(x.GetCurrent().ClassName));
                    resultList.All(x => classNamePattern.IsMatch(x.GetCurrent().ClassName));
                }
                controlTypeNames =
                    controlTypes.Select(ct => null != ct ? ct.ProgrammaticName.Substring(12) : string.Empty).ToArray();
                if (null != controlType)
                {
                    MbUnit.Framework.Assert.ForAll(resultList.Cast <IUiElement>().ToList <IUiElement>(), x => controlTypeNames.Contains(x.GetCurrent().ControlType.ProgrammaticName.Substring(12)));
                    resultList.All(x => controlTypeNames.Contains(x.GetCurrent().ControlType.ProgrammaticName.Substring(12)));
                }

                if (!string.IsNullOrEmpty(txtValue))
                {
                    MbUnit.Framework.Assert.ForAll(
                        resultList
                        .Cast <IUiElement>()
                        .ToList <IUiElement>(), x =>
                    {
                        IValuePattern valuePattern = x.GetCurrentPattern <IValuePattern>(ValuePattern.Pattern) as IValuePattern;
                        return(valuePattern != null && txtValuePattern.IsMatch(valuePattern.Current.Value));
                    });

                    resultList.All(
                        x => {
                        IValuePattern valuePattern = x.GetCurrentPattern <IValuePattern>(ValuePattern.Pattern) as IValuePattern;
                        return(valuePattern != null && txtValuePattern.IsMatch(valuePattern.Current.Value));
                    });
                }
                break;

            case UsualWildcardRegex.Regex:
                // 20140312
//                    if (!string.IsNullOrEmpty(name)) {
//                        MbUnit.Framework.Assert.ForAll(resultList.Cast<IUiElement>().ToList<IUiElement>(), x => Regex.IsMatch(x.Current.Name, name));
//                        resultList.All(x => Regex.IsMatch(x.Current.Name, name));
//                    }
//                    if (!string.IsNullOrEmpty(automationId)) {
//                        MbUnit.Framework.Assert.ForAll(resultList.Cast<IUiElement>().ToList<IUiElement>(), x => Regex.IsMatch(x.Current.AutomationId, automationId));
//                        resultList.All(x => Regex.IsMatch(x.Current.AutomationId, automationId));
//                    }
//                    if (!string.IsNullOrEmpty(className)) {
//                        MbUnit.Framework.Assert.ForAll(resultList.Cast<IUiElement>().ToList<IUiElement>(), x => Regex.IsMatch(x.Current.ClassName, className));
//                        resultList.All(x => Regex.IsMatch(x.Current.ClassName, className));
//                    }
//                    controlTypeNames =
//                        controlTypes.Select(ct => null != ct ? ct.ProgrammaticName.Substring(12) : string.Empty).ToArray();
//                    if (null != controlType) {
//                        MbUnit.Framework.Assert.ForAll(resultList.Cast<IUiElement>().ToList<IUiElement>(), x => controlTypeNames.Contains(x.Current.ControlType.ProgrammaticName.Substring(12)));
//                        resultList.All(x => controlTypeNames.Contains(x.Current.ControlType.ProgrammaticName.Substring(12)));
//                    }
                if (!string.IsNullOrEmpty(name))
                {
                    MbUnit.Framework.Assert.ForAll(resultList.Cast <IUiElement>().ToList <IUiElement>(), x => Regex.IsMatch(x.GetCurrent().Name, name));
                    resultList.All(x => Regex.IsMatch(x.GetCurrent().Name, name));
                }
                if (!string.IsNullOrEmpty(automationId))
                {
                    MbUnit.Framework.Assert.ForAll(resultList.Cast <IUiElement>().ToList <IUiElement>(), x => Regex.IsMatch(x.GetCurrent().AutomationId, automationId));
                    resultList.All(x => Regex.IsMatch(x.GetCurrent().AutomationId, automationId));
                }
                if (!string.IsNullOrEmpty(className))
                {
                    MbUnit.Framework.Assert.ForAll(resultList.Cast <IUiElement>().ToList <IUiElement>(), x => Regex.IsMatch(x.GetCurrent().ClassName, className));
                    resultList.All(x => Regex.IsMatch(x.GetCurrent().ClassName, className));
                }
                controlTypeNames =
                    controlTypes.Select(ct => null != ct ? ct.ProgrammaticName.Substring(12) : string.Empty).ToArray();
                if (null != controlType)
                {
                    MbUnit.Framework.Assert.ForAll(resultList.Cast <IUiElement>().ToList <IUiElement>(), x => controlTypeNames.Contains(x.GetCurrent().ControlType.ProgrammaticName.Substring(12)));
                    resultList.All(x => controlTypeNames.Contains(x.GetCurrent().ControlType.ProgrammaticName.Substring(12)));
                }

                if (!string.IsNullOrEmpty(txtValue))
                {
                    MbUnit.Framework.Assert.ForAll(
                        resultList
                        .Cast <IUiElement>()
                        .ToList <IUiElement>(), x =>
                    {
                        IValuePattern valuePattern = x.GetCurrentPattern <IValuePattern>(ValuePattern.Pattern) as IValuePattern;
                        return(valuePattern != null && Regex.IsMatch(valuePattern.Current.Value, txtValue));
                    });
                    Assert.True(
                        resultList.All(
                            x => {
                        IValuePattern valuePattern = x.GetCurrentPattern <IValuePattern>(ValuePattern.Pattern) as IValuePattern;
                        return(valuePattern != null && Regex.IsMatch(valuePattern.Current.Value, txtValue));
                    })
                        );
                }
                break;
            }
        }
コード例 #11
0
        private void TestParametersAgainstCollection(
            IEnumerable <int> processIds,
            IEnumerable <string> names,
            string automationId,
            string className,
            IEnumerable <IUiElement> collection,
            int expectedNumberOfElements)
        {
            // Arrange
            IUiElement rootElement =
                FakeFactory.GetElement_ForFindAll(
                    collection,
                    null);

            var windowSearcherData =
                new WindowSearcherData {
                ProcessIds   = processIds.ToArray(),
                Name         = new[] { string.Empty },
                AutomationId = automationId,
                Class        = className,
                First        = false,
                Recurse      = false
            };

            // Act
            List <IUiElement> resultList =
                RealCodeCaller.GetResultList_GetWindowCollectionByPid(
                    rootElement,
                    windowSearcherData);

            // Assert
            MbUnit.Framework.Assert.Count(expectedNumberOfElements, resultList);
            Assert.Equal(expectedNumberOfElements, resultList.Count);
//            string[] controlTypeNames;
//            switch (selector) {
//                case UIAutomationUnitTests.Helpers.Inheritance.UsualWildcardRegex.Wildcard:
//                    const WildcardOptions options = WildcardOptions.IgnoreCase;
//                    WildcardPattern namePattern = new WildcardPattern(name, options);
//                    WildcardPattern automationIdPattern = new WildcardPattern(automationId, options);
//                    WildcardPattern classNamePattern = new WildcardPattern(className, options);
//                    WildcardPattern txtValuePattern = new WildcardPattern(txtValue, options);
//
//                    if (!string.IsNullOrEmpty(name)) {
//                        MbUnit.Framework.Assert.ForAll(resultList.Cast<IUiElement>().ToList<IUiElement>(), x => namePattern.IsMatch(x.Current.Name));
//                        resultList.All(x => namePattern.IsMatch(x.Current.Name));
//                    }
//                    if (!string.IsNullOrEmpty(automationId)) {
//                        MbUnit.Framework.Assert.ForAll(resultList.Cast<IUiElement>().ToList<IUiElement>(), x => automationIdPattern.IsMatch(x.Current.AutomationId));
//                        resultList.All(x => automationIdPattern.IsMatch(x.Current.AutomationId));
//                    }
//                    if (!string.IsNullOrEmpty(className)) {
//                        MbUnit.Framework.Assert.ForAll(resultList.Cast<IUiElement>().ToList<IUiElement>(), x => classNamePattern.IsMatch(x.Current.ClassName));
//                        resultList.All(x => classNamePattern.IsMatch(x.Current.ClassName));
//                    }
//                    controlTypeNames =
//                        controlTypes.Select(ct => null != ct ? ct.ProgrammaticName.Substring(12) : string.Empty).ToArray();
//                    if (null != controlType) {
//                        MbUnit.Framework.Assert.ForAll(resultList.Cast<IUiElement>().ToList<IUiElement>(), x => controlTypeNames.Contains(x.Current.ControlType.ProgrammaticName.Substring(12)));
//                        resultList.All(x => controlTypeNames.Contains(x.Current.ControlType.ProgrammaticName.Substring(12)));
//                    }
//
//                    if (!string.IsNullOrEmpty(txtValue)) {
//                        MbUnit.Framework.Assert.ForAll(
//                            resultList
//                            .Cast<IUiElement>()
//                            .ToList<IUiElement>(), x =>
//                            {
//                                IValuePattern valuePattern = x.GetCurrentPattern<IValuePattern>(ValuePattern.Pattern) as IValuePattern;
//                                return valuePattern != null && txtValuePattern.IsMatch(valuePattern.Current.Value);
//                            });
//
//                        resultList.All(
//                            x => {
//                                IValuePattern valuePattern = x.GetCurrentPattern<IValuePattern>(ValuePattern.Pattern) as IValuePattern;
//                                return valuePattern != null && txtValuePattern.IsMatch(valuePattern.Current.Value);
//                            });
//                    }
//                    break;
//                case UIAutomationUnitTests.Helpers.Inheritance.UsualWildcardRegex.Regex:
//                    if (!string.IsNullOrEmpty(name)) {
//                        MbUnit.Framework.Assert.ForAll(resultList.Cast<IUiElement>().ToList<IUiElement>(), x => Regex.IsMatch(x.Current.Name, name));
//                        resultList.All(x => Regex.IsMatch(x.Current.Name, name));
//                    }
//                    if (!string.IsNullOrEmpty(automationId)) {
//                        MbUnit.Framework.Assert.ForAll(resultList.Cast<IUiElement>().ToList<IUiElement>(), x => Regex.IsMatch(x.Current.AutomationId, automationId));
//                        resultList.All(x => Regex.IsMatch(x.Current.AutomationId, automationId));
//                    }
//                    if (!string.IsNullOrEmpty(className)) {
//                        MbUnit.Framework.Assert.ForAll(resultList.Cast<IUiElement>().ToList<IUiElement>(), x => Regex.IsMatch(x.Current.ClassName, className));
//                        resultList.All(x => Regex.IsMatch(x.Current.ClassName, className));
//                    }
//                    controlTypeNames =
//                        controlTypes.Select(ct => null != ct ? ct.ProgrammaticName.Substring(12) : string.Empty).ToArray();
//                    if (null != controlType) {
//                        MbUnit.Framework.Assert.ForAll(resultList.Cast<IUiElement>().ToList<IUiElement>(), x => controlTypeNames.Contains(x.Current.ControlType.ProgrammaticName.Substring(12)));
//                        resultList.All(x => controlTypeNames.Contains(x.Current.ControlType.ProgrammaticName.Substring(12)));
//                    }
//                    if (!string.IsNullOrEmpty(txtValue)) {
//                        MbUnit.Framework.Assert.ForAll(
//                            resultList
//                            .Cast<IUiElement>()
//                            .ToList<IUiElement>(), x =>
//                            {
//                                IValuePattern valuePattern = x.GetCurrentPattern<IValuePattern>(ValuePattern.Pattern) as IValuePattern;
//                                return valuePattern != null && Regex.IsMatch(valuePattern.Current.Value, txtValue);
//                            });
//                        Xunit.Assert.True(
//                            resultList.All(
//                                x => {
//                                    IValuePattern valuePattern = x.GetCurrentPattern<IValuePattern>(ValuePattern.Pattern) as IValuePattern;
//                                    return valuePattern != null && Regex.IsMatch(valuePattern.Current.Value, txtValue);
//                                })
//                           );
//                    }
//                    break;
//            }
        }
コード例 #12
0
        private void TestParametersAgainstCollection(
            ControlType controlType,
            string searchString,
            IEnumerable <IUiElement> collection,
            int expectedNumberOfElements)
        {
            // Arrange
            string controlTypeString = string.Empty;

            if (null != controlType)
            {
                controlTypeString = controlType.ProgrammaticName.Substring(12);
            }

            GetControlCmdletBase cmdlet =
                FakeFactory.Get_GetControlCmdletBase(controlType, searchString);
            Condition condition =
                ControlSearcher.GetTextSearchCondition(searchString, new string[] { controlTypeString }, false);
            IUiElement element =
                FakeFactory.GetElement_ForFindAll(
                    collection,
                    condition);

            // Act
            var resultList = RealCodeCaller.GetResultList_TextSearch(element, condition);

            // Assert
            MbUnit.Framework.Assert.Count(expectedNumberOfElements, resultList);
            Assert.Equal(expectedNumberOfElements, resultList.Count);
            if (!string.IsNullOrEmpty(searchString))
            {
                MbUnit.Framework.Assert.ForAll(
                    resultList.Cast <IUiElement>().ToList <IUiElement>(),
                    // 20140312
//                    x => x.Current.Name == searchString || x.Current.AutomationId == searchString || x.Current.ClassName == searchString ||
                    x => x.GetCurrent().Name == searchString || x.GetCurrent().AutomationId == searchString || x.GetCurrent().ClassName == searchString ||
                    (null != (x.GetCurrentPattern <IValuePattern>(ValuePattern.Pattern) as IValuePattern) && (x.GetCurrentPattern <IValuePattern>(ValuePattern.Pattern) as IValuePattern).Current.Value == searchString));

                /*
                 * (null != (x.GetCurrentPattern<IValuePattern>(ValuePattern.Pattern) as IValuePattern) ?
                 *   // (x.GetCurrentPattern<IValuePattern, ValuePattern>(ValuePattern.Pattern) as IValuePattern).Current.Value == searchString :
                 *   (x.GetCurrentPattern<IValuePattern>(ValuePattern.Pattern) as IValuePattern).Current.Value == searchString :
                 *   false));
                 */
            }
//            if (null != controlType) {
//                MbUnit.Framework.Assert.ForAll(resultList.Cast<IUiElement>().ToList<IUiElement>(), x => x.Current.ControlType == controlType);
//            }

            Assert.Equal(expectedNumberOfElements, resultList.Count);
            if (!string.IsNullOrEmpty(searchString))
            {
                resultList.All(
                    // 20140312
                    // x => x.Current.Name == searchString || x.Current.AutomationId == searchString || x.Current.ClassName == searchString ||
                    x => x.GetCurrent().Name == searchString || x.GetCurrent().AutomationId == searchString || x.GetCurrent().ClassName == searchString ||
                    (null != (x.GetCurrentPattern <IValuePattern>(ValuePattern.Pattern) as IValuePattern) && (x.GetCurrentPattern <IValuePattern>(ValuePattern.Pattern) as IValuePattern).Current.Value == searchString));

                /*
                 * (null != (x.GetCurrentPattern<IValuePattern>(ValuePattern.Pattern) as IValuePattern) ?
                 *   (x.GetCurrentPattern<IValuePattern>(ValuePattern.Pattern) as IValuePattern).Current.Value == searchString :
                 *   false));
                 */
            }
        }