[monodoc] Ditto for fetching type node parents of subnodes.
[mono.git] / mcs / class / monodoc / Test / Monodoc / HelpSourceTests.cs
index f837c7ed38bafc362bc0167bf11710dc18481716..867c9b793898dfb675e3aa05f15da5df70e6ec4c 100644 (file)
@@ -7,6 +7,7 @@ using NUnit.Framework;
 
 using Monodoc;
 using Monodoc.Generators;
+using Monodoc.Providers;
 
 // Used by ReachabilityWithCrefsTest
 // using HtmlAgilityPack;
@@ -153,6 +154,23 @@ namespace MonoTests.Monodoc
                        Assert.IsTrue (rootTree.RenderUrl ("T:System.IComparable{T}", generator, out result), "#6");
                }
 
+               [Test]
+               public void PublicUrlOnUnattachedHelpSourceRoot ()
+               {
+                       // Unattached help source have no root:/ URL attributed
+                       var hs = new EcmaHelpSource (Path.Combine (BaseDir, "sources", "netdocs"), false);
+                       var rootTree = RootTree.LoadTree (Path.GetFullPath (BaseDir), false);
+                       hs.RootTree = rootTree;
+                       Assert.IsNull (hs.Tree.RootNode.PublicUrl);
+                       var nsChildUrl = hs.Tree.RootNode.ChildNodes.First ().PublicUrl;
+                       Assert.IsNotNull (nsChildUrl);
+                       StringAssert.StartsWith ("N:", nsChildUrl);
+                       // Verify GetNodeTypeParent
+                       var typeNode = hs.Tree.RootNode.ChildNodes.First ().ChildNodes.First ();
+                       var metaNode = typeNode.ChildNodes.First (cn => cn.Element == "M");
+                       StringAssert.StartsWith (typeNode.PublicUrl, metaNode.PublicUrl);
+               }
+
                /*
                [Test, Ignore ("Mono documentation is full of syntax errors so we can't use it reliably for this test")]
                public void ReachabilityWithCrefsTest ()