Пример #1
0
        static void Main(string[] args)
        {
            string inputFilePath = @"E:\MainTestFolder\MyTestFile.pdf";
            // OPTIONAL string ConvertedFilePath = @"E:\MainTestFolder\MyNewFile.pdf"; ;
            // OPTIONAL int dpi = 100; // if less than 1 or more than 600, dpi will be bounded
            RasterizePdf sample = new RasterizePdf(inputFilePath);

            // OPTIONAL sample.OutputFilePath = ConvertedFilePath;
            // OPTIONAL sample.Dpi = dpi;
            sample.Convert();
            // if default values used, converted file will be at @"E:\MainTestFolder\MyTestFile_Rasterized.pdf";
        }
        public void Convert_WithDefaultParameters()
        {
            // arrange
            RasterizePdf sample = new RasterizePdf(input);

            // act
            sample.Convert();

            // assert
            Assert.IsTrue(File.Exists(sample.OutputFilePath), "File does not exist");

            // clear new mess
            ClearMess(sample.OutputFilePath);
        }
        public void Convert_inputPathWithLithuanianLetters()
        {
            // arrange
            RasterizePdf sample = new RasterizePdf(input_with_characters);

            // act
            sample.Convert();

            // assert
            Assert.IsTrue(File.Exists(sample.OutputFilePath), "File does not exist");

            // clear new mess
            ClearMess(sample.OutputFilePath);
        }
        public void Convert_BadInputPath()
        {
            // arrange
            RasterizePdf sample = new RasterizePdf(bad_input);

            // act
            sample.Convert();

            // assert
            Assert.IsTrue(File.Exists(sample.OutputFilePath), "File does not exist");

            // clear new mess
            ClearMess(sample.OutputFilePath);
        }
        public void Convert_OutputPathSpecified_BadExtension()
        {
            // arrange
            RasterizePdf sample = new RasterizePdf(input);

            // act
            sample.OutputFilePath = BadSpecifiedOutputPathExtension;
            sample.Convert();

            // assert
            Assert.IsTrue(File.Exists(sample.OutputFilePath), "File does not exist");

            // clear new mess
            ClearMess(sample.OutputFilePath);
        }
        public void Convert_OutputPathSpecified()
        {
            // arrange
            RasterizePdf sample = new RasterizePdf(input);

            // act
            sample.OutputFilePath = SpecifiedOutputPath;
            sample.Convert();

            // assert
            Assert.AreEqual(SpecifiedOutputPath, sample.OutputFilePath, "Output directory not set");
            Assert.IsTrue(File.Exists(sample.OutputFilePath), "File does not exist");

            // clear new mess
            ClearMess(sample.OutputFilePath);
        }
        public void Convert_DpiSpecified_tooHighOrTooLow()
        {
            foreach (int specifiedDpi in SpecifiedDpi)
            {
                // arrange
                RasterizePdf sample = new RasterizePdf(input);

                // act
                sample.Dpi = specifiedDpi; // 1 <= Dpi <= 600 otherwise fails
                sample.Convert();

                // assert
                Assert.IsTrue(File.Exists(sample.OutputFilePath), "File does not exist");

                // clear new mess
                ClearMess(sample.OutputFilePath);
            }
        }