Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            const string StrictSwitch = "-strict";

            bool treatWarningsAsErrors = false;
            var arguments = args.ToList();
            if (arguments.Contains(StrictSwitch))
            {
                treatWarningsAsErrors = true;
                arguments.Remove(StrictSwitch);
            }

            if (arguments.Count != 1)
            {
                Console.Error.WriteLine("Usage: XmlDoc2CmdletDoc.exe [{0}] assemblyPath", StrictSwitch);
                Environment.Exit(-1);
            }
            else
            {
                var options = new Options(treatWarningsAsErrors, arguments.First());
                Console.WriteLine(options);
                var engine = new Engine();
                var exitCode = engine.GenerateHelp(options);
                Console.WriteLine("GenerateHelp completed with exit code '{0}'", exitCode);
                Environment.Exit((int)exitCode);
            }
        }
Exemplo n.º 2
0
        public void SetUp()
        {
            // ARRANGE
            var assemblyPath = typeof(TestManualElementsCommand).Assembly.Location;
            var cmdletXmlHelpPath = Path.ChangeExtension(assemblyPath, ".dll-Help.xml");
            if (File.Exists(cmdletXmlHelpPath))
            {
                File.Delete(cmdletXmlHelpPath);
            }

            // ACT
            var options = new Options(false, assemblyPath);
            var engine = new Engine();
            engine.GenerateHelp(options);

            // ASSERT
            Assert.That(File.Exists(cmdletXmlHelpPath));

            using (var stream = File.OpenRead(cmdletXmlHelpPath))
            {
                var document = XDocument.Load(stream);
                rootElement = document.Root;
            }
            testManualElementsCommandElement = rootElement.XPathSelectElement("command:command[command:details/command:name/text() = 'Test-ManualElements']", resolver);
            testMamlElementsCommandElement = rootElement.XPathSelectElement("command:command[command:details/command:name/text() = 'Test-MamlElements']", resolver);
            testReferencesCommandElement = rootElement.XPathSelectElement("command:command[command:details/command:name/text() = 'Test-References']", resolver);
            testInputTypesCommandElement = rootElement.XPathSelectElement("command:command[command:details/command:name/text() = 'Test-InputTypes']", resolver);
        }