public void GetByNameTest() { HtmlElement root = new HtmlElement("root"); HtmlNodeCollection target = new HtmlNodeCollection(root); target.Add(new HtmlElement("first")); target.Add(new HtmlElement("second")); target.Add(new HtmlElement("second")); Assert.AreEqual(target.GetByName("second").Count, 2); ((HtmlElement)target[0]).Nodes.Add(new HtmlElement("second")); Assert.AreEqual(target.GetByName("second", false).Count, 2); Assert.AreEqual(target.GetByName("second").Count, 3); }