public void ShouldDescribePath() { XmlDocument xml = new DocumentFactory().CreateFromString(XML_SIMPLE); XmlNode node = new XPathHelper().GetSingleNode(xml.DocumentElement, "//fred"); NUnit.Framework.Assert.AreEqual("/outer/fred", Ca.Infoway.Messagebuilder.Util.Xml.XmlDescriber.DescribePath(node), "path"); }
public void ShouldDescribePathWithNonContiguousMultiples() { XmlDocument xml = new DocumentFactory() .CreateFromString(XML_REPEATED_NAME_NON_CONTIGUOUS); XmlNode node = new XPathHelper().GetSingleNode(xml.DocumentElement, "//dummy"); NUnit.Framework.Assert.AreEqual("/outer/child[3]/dummy", Ca.Infoway.Messagebuilder.Util.Xml.XmlDescriber .DescribePath(node), "path"); }
public void ShouldDescribePathWithMultiplesInParentHierarchyAndAttribute() { XmlDocument xml = new DocumentFactory() .CreateFromString(XML_MORE_COMPLICATED); XmlNode node = new XPathHelper().GetSingleNode(xml.DocumentElement, "//grandchild/@name"); NUnit.Framework.Assert.AreEqual("/outer/child[1]/grandchild/@name", Ca.Infoway.Messagebuilder.Util.Xml.XmlDescriber .DescribePath(node), "path"); }