コード例 #1
0
ファイル: TestHelper.cs プロジェクト: supermanc88/PDFCreator
 /// <summary>
 ///     Creates testfiles according to the TestFile enum and returns its path.
 ///     Uses testFile name for the file name
 /// </summary>
 /// <param name="testFile">Choose a testfile from the enum</param>
 /// <returns>Path to the created testfile</returns>
 public string GenerateTestFile(TestFile testFile)
 {
     return(GenerateTestFile(testFile, testFile.ToString()));
 }
コード例 #2
0
 public string Path(TestFile filename) =>
 System.IO.Path.Combine(_path, filename.ToString());
コード例 #3
0
ファイル: TestHelper.cs プロジェクト: supermanc88/PDFCreator
 /// <summary>
 ///     Generates a job with default testpasswords (if required by the profile settings)
 ///     and sets a tesfile as output, without running it.
 ///     Note: The INF- and the PS file will be created with the content of the PDFCreatorTestpage
 /// </summary>
 /// <param name="testFileAsOutput">Testfile setted as output</param>
 ///
 public void GenerateGsJob_WithSetOutput(TestFile testFileAsOutput)
 {
     GenerateGsJob_WithSetOutput(testFileAsOutput, testFileAsOutput.ToString());
 }
コード例 #4
0
        public string GenerateTestFile(TestFile testFile, string fileName)
        {
            var testFileName = fileName;

            if (string.IsNullOrWhiteSpace(testFileName))
            {
                testFileName = testFile.ToString();
            }

            var testfilePath = Path.Combine(TmpTestFolder, testFileName + ".pdf");

            switch (testFile)
            {
            case TestFile.Attachment3PagesPDF:
                File.WriteAllBytes(testfilePath, Resources.Attachment3PagesPDF);
                break;

            case TestFile.Background3PagesPDF:
                File.WriteAllBytes(testfilePath, Resources.Background3PagesPDF);
                break;

            case TestFile.CertificationFileP12:
                testfilePath = testfilePath.Replace(".pdf", ".p12");
                File.WriteAllBytes(testfilePath, Resources.CertificationFileP12);
                break;

            case TestFile.CertificationFile_ExpiredP12:
                testfilePath = testfilePath.Replace(".pdf", ".p12");
                File.WriteAllBytes(testfilePath, Resources.CertificationFile_ExpiredP12);
                break;

            case TestFile.Cover2PagesPDF:
                File.WriteAllBytes(testfilePath, Resources.Cover2PagesPDF);
                break;

            case TestFile.Cover2PagesSixEmptyPagesPDF:
                File.WriteAllBytes(testfilePath, Resources.Cover2PagesSixEmptyPagesPDF);
                break;

            case TestFile.Cover2PagesSixEmptyPagesAttachment3PagesPDF:
                File.WriteAllBytes(testfilePath, Resources.Cover2PagesSixEmptyPagesAttachment3PagesPDF);
                break;

            case TestFile.FourRotatingPDFCreatorTestpagesPDF:
                File.WriteAllBytes(testfilePath, Resources.FourRotatingPDFCreatorTestpagesPDF);
                break;

            case TestFile.PageRotation0PDF:
                File.WriteAllBytes(testfilePath, Resources.PageRotation0PDF);
                break;

            case TestFile.PageRotation180PDF:
                File.WriteAllBytes(testfilePath, Resources.PageRotation180PDF);
                break;

            case TestFile.PageRotation270PDF:
                File.WriteAllBytes(testfilePath, Resources.PageRotation270PDF);
                break;

            case TestFile.PageRotation90PDF:
                File.WriteAllBytes(testfilePath, Resources.PageRotation90PDF);
                break;

            case TestFile.PDFCreatorTestpage_GS9_19_PDF:
                File.WriteAllBytes(testfilePath, Resources.PDFCreatorTestpage_GS9_19_PDF);
                break;

            case TestFile.PDFCreatorTestpage_GS9_19_PDF_A_1b:
                File.WriteAllBytes(testfilePath, Resources.PDFCreatorTestpage_GS9_19_PDF_A_1b);
                break;

            case TestFile.PDFCreatorTestpage_GS9_19_PDF_A_2b:
                File.WriteAllBytes(testfilePath, Resources.PDFCreatorTestpage_GS9_19_PDF_A_2b);
                break;

            case TestFile.PDFCreatorTestpage_GS9_19_PDF_X:
                File.WriteAllBytes(testfilePath, Resources.PDFCreatorTestpage_GS9_19_PDF_X);
                break;

            case TestFile.PortraitLandscapeLandscapeLandscapePortraitPDF:
                File.WriteAllBytes(testfilePath, Resources.PortraitLandscapeLandscapeLandscapePortraitPDF);
                break;

            case TestFile.SixEmptyPagesPDF:
                File.WriteAllBytes(testfilePath, Resources.SixEmptyPagesPDF);
                break;

            case TestFile.SixEmptyPagesAttachment3PagesPDF:
                File.WriteAllBytes(testfilePath, Resources.SixEmptyPagesAttachment3PagesPDF);
                break;

            case TestFile.ScriptCopyFilesToDirectoryCMD:
                testfilePath = testfilePath.Replace(".pdf", ".cmd");
                File.WriteAllText(testfilePath, Resources.ScriptCopyFilesToDirectoryCMD);
                break;

            case TestFile.ThreePDFCreatorTestpagesPDF:
                File.WriteAllBytes(testfilePath, Resources.ThreePDFCreatorTestpagesPDF);
                break;

            case TestFile.PDFCreatorTestpagePs:
                testfilePath = testfilePath.Replace(".pdf", ".ps");
                File.WriteAllBytes(testfilePath, Resources.PDFCreatorTestpagePS);
                break;

            case TestFile.PDFCreatorTestpageJPG:
                testfilePath = testfilePath.Replace(".pdf", ".jpg");
                Resources.PDFCreatorTestpageJPG.Save(testfilePath.Replace(".pdf", ".jpg"));
                break;

            case TestFile.PDFCreatorTestpageTIF:
                testfilePath = testfilePath.Replace(".pdf", ".tif");
                Resources.PDFCreatorTestpageTIF.Save(testfilePath);
                break;

            case TestFile.PDFCreatorTestpageTXT:
                testfilePath = testfilePath.Replace(".pdf", ".txt");
                File.WriteAllText(testfilePath, Resources.PDFCreatorTestpageTXT);
                break;

            case TestFile.PDFCreatorTestpagePNG:
                testfilePath = testfilePath.Replace(".pdf", ".png");
                Resources.PDFCreatorTestpagePNG.Save(testfilePath);

                break;
            }

            return(testfilePath);
        }