public static int GetNodeLevel (Node node)
{
int i = 0;
- for (; !node.Element.StartsWith ("root:/", StringComparison.OrdinalIgnoreCase); i++)
+ for (; !node.Element.StartsWith ("root:/", StringComparison.OrdinalIgnoreCase); i++) {
node = node.Parent;
+ if (node == null)
+ return i - 1;
+ }
return i - 1;
}
using Monodoc;
using Monodoc.Generators;
+using Monodoc.Providers;
// Used by ReachabilityWithCrefsTest
// using HtmlAgilityPack;
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);
+ }
+
/*
[Test, Ignore ("Mono documentation is full of syntax errors so we can't use it reliably for this test")]
public void ReachabilityWithCrefsTest ()