コード例 #1
0
ファイル: HelpTextTests.cs プロジェクト: icnocop/HtmlToPdf
        public void HelpArgument_DisplaysHelpText(string commandLine)
        {
            string expectedOutput = HelpTextGenerator.Generate();

            HtmlToPdfRunner runner = new HtmlToPdfRunner(HtmlToPdfRunner.HtmlToPdfExe);

            HtmlToPdfRunResult result = runner.Run(commandLine);

            Assert.AreEqual(1, result.ExitCode, result.Output);
            Assert.IsTrue(string.IsNullOrEmpty(result.StandardOutput), result.StandardOutput);
            StringAssertWithDiff.AreEqual(expectedOutput.Trim(), result.StandardError.Trim());
        }
コード例 #2
0
ファイル: HelpTextTests.cs プロジェクト: icnocop/HtmlToPdf
        public void NoArguments_DisplaysErrorAndHelpText()
        {
            string expectedOutput = "System.ApplicationException: At least one input must be specified.";

            HtmlToPdfRunner runner = new HtmlToPdfRunner(HtmlToPdfRunner.HtmlToPdfExe);

            HtmlToPdfRunResult result = runner.Run("--log-level Error");

            Assert.AreEqual(1, result.ExitCode, result.Output);
            Assert.IsTrue(string.IsNullOrEmpty(result.StandardOutput), result.StandardOutput);
            int length = expectedOutput.Trim().Length;

            StringAssertWithDiff.AreEqual(expectedOutput.Trim(), result.StandardError.Trim().Substring(0, length));
        }
コード例 #3
0
        public void DumpDefaultTocXsl_OutputsDefaultTocXslToStandardOutput(string exeFileName, bool removeEmptyLines)
        {
            HtmlToPdfRunner runner = new HtmlToPdfRunner(exeFileName);

            string             commandLine = "--dump-default-toc-xsl";
            HtmlToPdfRunResult result      = runner.Run(commandLine);

            Assert.AreEqual(0, result.ExitCode, result.Output);

            // remove empty lines
            string output = result.StandardOutput;

            if (removeEmptyLines)
            {
                output = output
                         .Replace("\r\n", "\r")
                         .Replace("\r\r", "\r\n");
            }

            string expected = TableOfContentsStyleSheetBuilder.Build(true);

            StringAssertWithDiff.AreEqual(expected.Trim(), output.Trim());
        }