public void ShouldLimitPropertiesAccess(
            ElementAttributeAccessModifier scope,
            string expectedId,
            string expectedText,
            string expectedClr)
        {
            UiDispatch.Invoke(
                () =>
            {
                var element       = CreateTestElement();
                var winiumElement = new WiniumElement(element);

                var auotmationId = GetElementAttributeCommand.GetPropertyCascade(
                    winiumElement,
                    "AutomationProperties.AutomationId",
                    scope);

                var text = GetElementAttributeCommand.GetPropertyCascade(winiumElement, "Text", scope);

                var clr = GetElementAttributeCommand.GetPropertyCascade(winiumElement, "ClrProperty", scope);

                Assert.AreEqual(expectedId, auotmationId);
                Assert.AreEqual(expectedText, text);
                Assert.AreEqual(expectedClr, clr);
            }).Wait();
        }
        internal static object GetPropertyCascade(
            WiniumElement element,
            string key,
            ElementAttributeAccessModifier options)
        {
            object propertyObject;

            if (element.TryGetAutomationProperty(key, out propertyObject))
            {
                return(propertyObject);
            }

            if (options == ElementAttributeAccessModifier.AutomationProperties)
            {
                return(null);
            }

            if (element.TryGetDependencyProperty(key, out propertyObject))
            {
                return(propertyObject);
            }

            if (options == ElementAttributeAccessModifier.DependencyProperties)
            {
                return(null);
            }

            if (element.TryGetProperty(key, out propertyObject))
            {
                return(propertyObject);
            }

            return(null);
        }