ParseAttributes() private method

private ParseAttributes ( XmlElement, xmlElement ) : void
xmlElement XmlElement,
return void
Beispiel #1
0
        public void ParseUnquotedAttribute()
        {
            IHtmlParser parser     = new HtmlParser();
            var         attributes = new Dictionary <string, string>();

            parser.ParseAttributes(" class=test", attributes);

            Assert.AreEqual(1, attributes.Count);
            Assert.AreEqual("class", attributes.Keys.First());
            Assert.AreEqual("test", attributes.Values.First());
        }
Beispiel #2
0
        public void ParseAttributes_Should_Return_Two_Attributes()
        {
            string input  = "<a href='#' target=\"_blank\">";
            var    parser = new HtmlParser(input)
            {
                Position = 3
            };

            Attribute[] attributes = parser.ParseAttributes();

            Assert.IsNotNull(attributes);
            Assert.AreEqual(2, attributes.Length);
            Assert.AreEqual("href", attributes[0].Name);
            Assert.AreEqual("#", attributes[0].Value);
            Assert.AreEqual("target", attributes[1].Name);
            Assert.AreEqual("_blank", attributes[1].Value);
        }