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()); }
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)); }
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()); }