Beispiel #1
0
        public void FromReader_ThrowsOnInvalidHeader(string header)
        {
            // Arrange

            // Act

            // Assert
            using (var pdfStream = BuildTestStream(header))
            {
                using (var reader = new PdfReader(pdfStream))
                {
                    Assert.Throws <FormatException>(() => PdfVersion.FromReader(reader));
                }
            }
        }
Beispiel #2
0
        public void FromReader_ReadsPdfVersion()
        {
            // Arrange
            PdfVersion version;

            // Act
            using (var pdfStream = BuildTestStream("%PDF-1.6\r\n"))
            {
                using (var reader = new PdfReader(pdfStream))
                {
                    version = PdfVersion.FromReader(reader);
                }
            }

            // Assert
            Assert.NotNull(version);
            Assert.Equal(1, version.Major);
            Assert.Equal(6, version.Minor);
        }
Beispiel #3
0
        public void FromReader_ReadsPdfVersionAtBeginning()
        {
            // Arrange
            PdfVersion version;

            // Act
            using (var pdfStream = BuildTestStream("%PDF-1.4\r\nSome Content\r\n%PDF-1.6\r\n"))
            {
                using (var reader = new PdfReader(pdfStream))
                {
                    reader.Position = 22;
                    version         = PdfVersion.FromReader(reader);
                }
            }

            // Assert
            Assert.NotNull(version);
            Assert.Equal(1, version.Major);
            Assert.Equal(4, version.Minor);
        }