public void FindByAttributeNameValueTest() { HtmlElement root = new HtmlElement("root"); HtmlNodeCollection target = new HtmlNodeCollection(root); target.Add(new HtmlElement("first")); target.Add(new HtmlElement("second")); target.Add(new HtmlElement("third")); ((HtmlElement)target[1]).Nodes.Add(new HtmlElement("secondchild")); ((HtmlElement)target[1]).Attributes.Add(new HtmlAttribute("firstattribute", "firstvalue")); ((HtmlElement)target[1]).Attributes.Add(new HtmlAttribute("secondattribute", "firstvalue")); ((HtmlElement)target[2]).Attributes.Add(new HtmlAttribute("firstattribute", "secondvalue")); ((HtmlElement)((HtmlElement)target[1]).Nodes[0]).Attributes.Add(new HtmlAttribute("secondattribute", "secondvalue")); ((HtmlElement)((HtmlElement)target[1]).Nodes[0]).Attributes.Add(new HtmlAttribute("firstattribute", "anothervalue")); Assert.AreEqual(target.FindByAttributeNameValue("firstattribute", "secondvalue", false).Count, 1); Assert.AreEqual(target.FindByAttributeNameValue("firstattribute", "anothervalue").Count, 1); }