public void NamespaceQuery() { string xml = "<?xml version='1.0'?>\r\n" + "<Xml1></Xml1>"; XPathQuery query = new XPathQuery(xml); XPathNodeMatch[] nodes = query.FindNodes("//namespace::*"); ServiceContainer container = new ServiceContainer(); container.AddService(typeof(MockTextMarkerService), new MockTextMarkerService()); AvalonEditDocumentAdapter doc = new AvalonEditDocumentAdapter(new ICSharpCode.AvalonEdit.Document.TextDocument(), container); doc.Text = xml; XPathNodeTextMarker xpathNodeMarker = new XPathNodeTextMarker(doc); xpathNodeMarker.AddMarkers(nodes); ITextMarkerService service = doc.GetService(typeof(MockTextMarkerService)) as ITextMarkerService; List <ITextMarker> markers = new List <ITextMarker>(service.TextMarkers); Assert.AreEqual(0, markers.Count); Assert.AreEqual(1, nodes.Length); }
public void EmptyCommentNode() { string xml = "<!----><root/>"; XPathQuery query = new XPathQuery(xml); XPathNodeMatch[] nodes = query.FindNodes("//comment()"); ServiceContainer container = new ServiceContainer(); container.AddService(typeof(MockTextMarkerService), new MockTextMarkerService()); AvalonEditDocumentAdapter doc = new AvalonEditDocumentAdapter(new ICSharpCode.AvalonEdit.Document.TextDocument(), container); doc.Text = xml; XPathNodeTextMarker xpathNodeMarker = new XPathNodeTextMarker(doc); xpathNodeMarker.AddMarkers(nodes); ITextMarkerService service = doc.GetService(typeof(MockTextMarkerService)) as ITextMarkerService; List <ITextMarker> markers = new List <ITextMarker>(service.TextMarkers); Assert.AreEqual(0, markers.Count); Assert.AreEqual(1, nodes.Length); }