1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
5
using System.Collections.Generic;
6
using System.Collections.ObjectModel;
8
using System.Xml.XPath;
10
using ICSharpCode.XmlEditor;
11
using NUnit.Framework;
12
using XmlEditor.Tests.Utils;
14
namespace XmlEditor.Tests.XPath
17
public class NamespaceXPathQueryTestFixture
20
XPathNodeMatch xmlNamespaceNode;
21
XPathNodeMatch[] nodes;
26
string xml = "<root xmlns='http://foo.com'/>";
27
XPathQuery query = new XPathQuery(xml);
28
nodes = query.FindNodes("//namespace::*");
30
xmlNamespaceNode = nodes[1];
34
public void TwoNamespaceNodesFoundByXPath()
36
Assert.AreEqual(2, nodes.Length);
40
public void FooNamespaceNodeFoundByXPath()
42
string nodeValue = "xmlns=\"http://foo.com\"";
43
string displayValue = "xmlns=\"http://foo.com\"";
46
XPathNodeType nodeType = XPathNodeType.Namespace;
47
XPathNodeMatch expectedMatch = new XPathNodeMatch(nodeValue, displayValue, lineNumber, linePosition, nodeType);
48
XPathNodeMatchComparison comparison = new XPathNodeMatchComparison();
49
Assert.IsTrue(comparison.AreEqual(expectedMatch, node), comparison.GetReasonForNotMatching());
53
public void XmlNamespaceNodeFoundByXPathHasNoLineInfo()
55
Assert.IsFalse(xmlNamespaceNode.HasLineInfo());
59
public void XmlNamespaceNodeFoundByXPathHasW3OrgSchemaNamespace()
61
Assert.AreEqual("xmlns:xml=\"http://www.w3.org/XML/1998/namespace\"", xmlNamespaceNode.Value);