PdfPig/src/UglyToad.PdfPig.Tests/Integration/EmbeddedFileAttachmentTests.cs
2019-12-21 16:16:36 +00:00

39 lines
1.1 KiB
C#

namespace UglyToad.PdfPig.Tests.Integration
{
using Xunit;
public class EmbeddedFileAttachmentTests
{
[Fact]
public void HasCorrectText()
{
var path = IntegrationHelpers.GetSpecificTestDocumentPath("embedded-file-attachment.pdf");
using (var document = PdfDocument.Open(path))
{
for (var i = 1; i <= document.NumberOfPages; i++)
{
var page = document.GetPage(i);
Assert.StartsWith("This is a test document. It contains a file attachment.", page.Text);
}
}
}
[Fact]
public void HasEmbeddedFiles()
{
var path = IntegrationHelpers.GetSpecificTestDocumentPath("embedded-file-attachment.pdf");
using (var document = PdfDocument.Open(path))
{
Assert.True(document.Advanced.TryGetEmbeddedFiles(out var files));
Assert.Equal(1, files.Count);
Assert.Equal(20668, files[0].Bytes.Count);
}
}
}
}