public void Verify_sanitize_of_single_mhtml_file() { var tempFile = Path.ChangeExtension(Path.GetTempFileName(), ".mht"); File.Copy(TestConfig.PathToMht, tempFile); string mhtml = File.ReadAllText(tempFile); MHTMLParser parser = new MHTMLParser(mhtml) { OutputDirectory = Path.GetDirectoryName(tempFile), DecodeImageData = true }; var outFile = Path.ChangeExtension(tempFile, ".html"); File.WriteAllText(outFile, parser.getHTMLText()); _sanitizer = new SafeHtmlConverter(outFile) { Logger = NullLogger.Instance }; var result = _sanitizer.Run("jobtest"); Assert.That(File.Exists(result), "Output pdf file not created"); File.Delete(result); }
public void Verify_preview_of_single_html_file() { var tempFile = Path.ChangeExtension(Path.GetTempFileName(), ".html"); File.Copy(TestConfig.PathToSimpleHtmlFile, tempFile); _converter = new HtmlToPdfConverterFromDiskFileOld(tempFile, _config); _converter.Logger = NullLogger.Instance; var result = _converter.Run("jobtest"); Assert.That(File.Exists(result), "Output pdf file not created"); File.Delete(result); }
public void Verify_sanitize_of_single_html_file() { var tempFile = Path.ChangeExtension(Path.GetTempFileName(), ".html"); File.Copy(TestConfig.PathToSimpleHtmlFile, tempFile); _sanitizer = new SafeHtmlConverter(tempFile) { Logger = NullLogger.Instance }; var result = _sanitizer.Run("jobtest"); Assert.That(File.Exists(result), "HTML file sanitized"); File.Delete(result); }