Inheritance: IHtmlElement
Exemplo n.º 1
0
 private static IHtmlElement CreateElement(Match match)
 {
     var element = new HtmlElement {
         TagName = match.Groups["tagName"].Value,
         InnerHtml = match.Groups["innerHtml"].Value
     };
     var attributeMatches = GetAttributeMatches(match);
     SetAttributes(element, attributeMatches);
     return element;
 }
Exemplo n.º 2
0
        public void First_for_empty_collection_should_get_empty_element()
        {
            var expectedElement = new HtmlElement {
                TagName = "",
                InnerHtml = ""
            };
            var elements = new IHtmlElement[] { };
            var collection = new HtmlCollection(elements);

            Assert.That(collection.First, Is.EqualTo(new HtmlElement())
                .Using(new HtmlElementEqualityComparer()));
        }
Exemplo n.º 3
0
 private static void SetAttributes(HtmlElement element, MatchCollection matches)
 {
     foreach (Match match in matches)
         element.SetAttribute(match.Groups["name"].Value, match.Groups["value"].Value);
 }