示例#1
0
        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);
        }
示例#2
0
        public static HelpSource GetHelpSource(string provider, string basefilepath)
        {
            HelpSource result;

            try {
                switch (provider)
                {
                case "xhtml":
                case "hb":
                    result = new XhtmlHelpSource(basefilepath, false);
                    break;

                case "man":
                    result = new ManHelpSource(basefilepath, false);
                    break;

                case "error":
                    result = new ErrorHelpSource(basefilepath, false);
                    break;

                case "ecmaspec":
                    result = new EcmaSpecHelpSource(basefilepath, false);
                    break;

                case "ecma":
                    result = new EcmaHelpSource(basefilepath, false);
                    break;

                default:
                    Console.Error.WriteLine("Error: Unknown provider specified: {0}", provider);
                    result = null;
                    break;
                }
            } catch (FileNotFoundException) {
                Console.Error.WriteLine("Error: did not find one of the files in sources/" + basefilepath);
                result = null;
            }
            return(result);
        }