public void XmlObjectGetAllPropertiesTest() { var xmlObj = new XmlObject(AtomXml, "atom", "m:type"); var actual = xmlObj .GetProperties("/atom:feed/atom:entry[2]/atom:author//*") .Aggregate("", (current, entry) => current + entry); Assert.AreEqual("/atom:feed[1]/atom:entry[2]/atom:author[1]/atom:name[1]", actual); }
public void XmlObjectGetPropertiesTest() { var a = new XmlObject( "<?pi test?><!--comment--><a type='string' alt='check'>test</a><b type='int'>4</b>", "q", "type"); var props = a.GetProperties("a/@*").ToList(); Assert.AreEqual(2, props.Count); Assert.AreEqual("/root[1]/a[1]/@type", props[0]); Assert.AreEqual("/root[1]/a[1]/@alt", props[1]); props = a.GetProperties("//comment()").ToList(); Assert.AreEqual("/root[1]/comment()", props[0]); var all = a.GetProperties(string.Empty).ToList(); Assert.AreEqual("/root[1]", all[0]); Assert.AreEqual(3, all.Count); a = new XmlObject("<root/>", "q", "type"); props = a.GetProperties("/root").ToList(); Assert.AreEqual(1, props.Count); }
public void XmlObjectGetPropertiesUnknownElementTest() { var a = new XmlObject("<?pi test?>", "q", null); _ = a.GetProperties("processing-instruction('pi')"); }