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()); IDocument doc = new ICSharpCode.AvalonEdit.Document.TextDocument() { ServiceProvider = 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()); IDocument doc = new ICSharpCode.AvalonEdit.Document.TextDocument() { ServiceProvider = 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()); IDocument doc = new ICSharpCode.AvalonEdit.Document.TextDocument() { ServiceProvider = 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 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()); IDocument doc = new ICSharpCode.AvalonEdit.Document.TextDocument() { ServiceProvider = 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); }