GetBooleanAttributeValue() публичный статический Метод

Returns true if value of attrName is 'true' or 'yes' (case ignored)
public static GetBooleanAttributeValue ( XmlNode node, string attrName ) : bool
node System.Xml.XmlNode The XmlNode to look in.
attrName string The optional attribute to find.
Результат bool
Пример #1
0
        public void GetBooleanAttributeValueTest()
        {
            // All in this section should return false.
            Assert.IsFalse(XmlUtils.GetBooleanAttributeValue(null), "Null returns false");
            Assert.IsFalse(XmlUtils.GetBooleanAttributeValue("FALSE"), "'FALSE' returns false");
            Assert.IsFalse(XmlUtils.GetBooleanAttributeValue("False"), "'False' returns false");
            Assert.IsFalse(XmlUtils.GetBooleanAttributeValue("false"), "'false' returns false");
            Assert.IsFalse(XmlUtils.GetBooleanAttributeValue("NO"), "'NO' returns false");
            Assert.IsFalse(XmlUtils.GetBooleanAttributeValue("No"), "'No' returns false");
            Assert.IsFalse(XmlUtils.GetBooleanAttributeValue("no"), "'no' returns false");

            // All in this section should return true.
            Assert.IsTrue(XmlUtils.GetBooleanAttributeValue("TRUE"), "'TRUE' returns true");
            Assert.IsTrue(XmlUtils.GetBooleanAttributeValue("True"), "'True' returns true");
            Assert.IsTrue(XmlUtils.GetBooleanAttributeValue("true"), "'true' returns true");
            Assert.IsTrue(XmlUtils.GetBooleanAttributeValue("YES"), "'YES' returns true");
            Assert.IsTrue(XmlUtils.GetBooleanAttributeValue("Yes"), "'Yes' returns true");
            Assert.IsTrue(XmlUtils.GetBooleanAttributeValue("yes"), "'yes' returns true");
        }
Пример #2
0
 public bool GetBooleanAttributeValue(string input)
 {
     return(XmlUtils.GetBooleanAttributeValue(input));
 }