示例#1
0
        /// <summary>
        /// Gets the value for the given <paramref name="attributename" />
        /// </summary>
        /// <param name="attributename">The attributename.</param>
        /// <returns>The value of the attribute</returns>
        public string GetValue(string attributename)
        {
            if (StringComparer.AreEqual(attributename, "style", true))
            {
                return(_htmlElement.style.cssText);
            }

            object attributeValue;

            if (attributename.ToLower(CultureInfo.InvariantCulture).StartsWith("style."))
            {
                attributeValue = Style.GetAttributeValue(attributename.Substring(6), _htmlElement.style);
            }
            else
            {
                attributeValue = _htmlElement.getAttribute(attributename, 0);
            }

            if (attributeValue == DBNull.Value || attributeValue == null)
            {
                return(null);
            }

            return(attributeValue.ToString());
        }
示例#2
0
        public string GetValue(string attributename)
        {
            string value = null;

            if (StringComparer.AreEqual(attributename, "href", true))
            {
                try
                {
                    value = Url;
                }
                catch {}
            }
            else if (StringComparer.AreEqual(attributename, "title", true))
            {
                try
                {
                    value = Title;
                }
                catch {}
            }
            else
            {
                throw new InvalidAttributException(attributename, "HTMLDialog");
            }

            return(value);
        }
示例#3
0
        public void TestsStaticCompare()
        {
            Assert.That(StringComparer.AreEqual("WatiN", "WatiN"), Is.True);
            Assert.That(StringComparer.AreEqual("WatiN", "watin"), Is.False);

            Assert.That(StringComparer.AreEqual("WatiN", "WatiN", true), Is.True);
            Assert.That(StringComparer.AreEqual("WatiN", "watin", true), Is.True);
        }
        private static bool FindByExactMatchOnIdPossible(BaseConstraint constraint)
        {
            Constraints.AttributeConstraint attributeConstraint = constraint as AttributeConstraint;

            return(attributeConstraint != null &&
                   StringComparer.AreEqual(attributeConstraint.AttributeName, "id", true) &&
                   !(constraint.HasAnd || constraint.HasOr) &&
                   attributeConstraint.Comparer.GetType() == typeof(StringComparer));
        }
        private bool CompareTagName(INativeElement nativeElement)
        {
            if (TagName == null)
            {
                return(true);
            }

            return(StringComparer.AreEqual(TagName, nativeElement.TagName, true));
        }
        private IHTMLElement2 GetFrameElement(string tagname)
        {
            IHTMLElementCollection elements = _frameSetParent.getElementsByTagName(tagname);

            foreach (DispHTMLBaseElement element in elements)
            {
                if (StringComparer.AreEqual(element.uniqueID, _frameElementUniqueId, true))
                {
                    return((IHTMLElement2)element);
                }
            }
            return(null);
        }
        /// <inheritdoc />
        protected override string GetAttributeValueImpl(string attributeName)
        {
            string value = null;

            if (StringComparer.AreEqual(attributeName, "href", true))
            {
                UtilityClass.TryActionIgnoreException(() => value = Url);
            }
            else if (StringComparer.AreEqual(attributeName, "title", true))
            {
                UtilityClass.TryActionIgnoreException(() => value = Title);
            }
            else
            {
                throw new InvalidAttributeException(attributeName, "HTMLDialog");
            }

            return(value);
        }
示例#8
0
        public void CompareShouldBeCultureInvariant()
        {
            // Get the tr-TR (Turkish-Turkey) culture.
            CultureInfo turkish = new CultureInfo("tr-TR");

            // Get the culture that is associated with the current thread.
            CultureInfo thisCulture = Thread.CurrentThread.CurrentCulture;

            try
            {
                // Set the culture to Turkish
                Thread.CurrentThread.CurrentCulture = turkish;

                StringComparer comparer = new StringComparer("I", true);
                Assert.That(comparer.Compare("i"), Is.True);

                Assert.That(StringComparer.AreEqual("I", "i", true), Is.True);
            }
            finally
            {
                // Set the culture back to the original
                Thread.CurrentThread.CurrentCulture = thisCulture;
            }
        }
 public static bool IsAnInputElement(string tagName)
 {
     return(StringComparer.AreEqual(tagName, ElementsSupport.InputTagName, true));
 }