Пример #1
0
 public void ShouldThrowExceptionWhenPasswordIsNull()
 {
     using (var file = new TemporaryFile("foo.pdf"))
     {
         Assert.Throws <ArgumentNullException>("password", () => PdfInfo.Create(file.FullName, null));
     }
 }
Пример #2
0
            public void ShouldReturnTheNumberOfPagesForPasswordProtectedFile()
            {
                if (!Ghostscript.IsAvailable)
                {
                    return;
                }

                var pdfInfo = PdfInfo.Create(Files.Coders.PdfExamplePasswordOriginalPDF, "test");

                Assert.Equal(4, pdfInfo.PageCount);
            }
Пример #3
0
            public void ShouldReturnTheNumberOfPages()
            {
                if (!Ghostscript.IsAvailable)
                {
                    return;
                }

                var pdfInfo = PdfInfo.Create(Files.Coders.SamplePDF);

                Assert.Equal(2, pdfInfo.PageCount);
            }
Пример #4
0
                public void ShouldThrowExceptionWhenFileIsPng()
                {
                    if (!Ghostscript.IsAvailable)
                    {
                        return;
                    }

                    var exception = Assert.Throws <MagickDelegateErrorException>(() => PdfInfo.Create(Files.CirclePNG));

                    Assert.Single(exception.RelatedExceptions);
                    Assert.Contains("Error: /syntaxerror in pdfopen", exception.RelatedExceptions.First().Message);
                }
Пример #5
0
 public void ShouldThrowExceptionWhenFileNameIsEmpty()
 {
     Assert.Throws <ArgumentException>("fileName", () => PdfInfo.Create(string.Empty));
 }
Пример #6
0
 public void ShouldThrowExceptionWhenFileNameIsNull()
 {
     Assert.Throws <ArgumentNullException>("fileName", () => PdfInfo.Create((string)null));
 }
Пример #7
0
 public void ShouldThrowExceptionWhenFileIsPng()
 {
     Assert.Throws <MagickDelegateErrorException>(() => PdfInfo.Create(Files.CirclePNG));
 }