string GetLineNumberIfHasLineInfo(XPathNodeMatch nodeMatch) { if (nodeMatch.HasLineInfo()) { return(nodeMatch.LineNumber.ToString()); } return("null"); }
public bool AreEqual(XPathNodeMatch lhs, XPathNodeMatch rhs) { reason.Clear(); foreach (PropertyInfo property in typeof(XPathNodeMatch).GetProperties()) { ComparePropertyValues(property, lhs, rhs); } if (lhs.HasLineInfo() != rhs.HasLineInfo()) { AppendPropertyDoesNotMatchMessage("LineNumber", GetLineNumberIfHasLineInfo(lhs), GetLineNumberIfHasLineInfo(rhs)); } return(!HasReasonForNotMatching); }
public void NamespaceNode() { string xml = "<root xmlns='http://foo.com'/>"; XPathNodeMatch[] nodes = XmlView.SelectNodes(xml, "//namespace::*"); XPathNodeMatch node = nodes[0]; XPathNodeMatch xmlNamespaceNode = nodes[1]; Assert.AreEqual(2, nodes.Length); Assert.AreEqual(0, node.LineNumber); Assert.AreEqual(6, node.LinePosition); Assert.AreEqual("xmlns=\"http://foo.com\"", node.Value); Assert.AreEqual("xmlns=\"http://foo.com\"", node.DisplayValue); Assert.IsFalse(xmlNamespaceNode.HasLineInfo()); Assert.AreEqual("xmlns:xml=\"http://www.w3.org/XML/1998/namespace\"", xmlNamespaceNode.Value); }
public void XmlNamespaceNodeFoundByXPathHasNoLineInfo() { Assert.IsFalse(xmlNamespaceNode.HasLineInfo()); }