PdfPig/src/UglyToad.PdfPig.Tests/Integration/EmbeddedFileAttachmentTests.cs
2024-03-16 07:40:17 +00:00

37 lines
1.1 KiB
C#

namespace UglyToad.PdfPig.Tests.Integration
{
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.Single(files);
Assert.Equal(20668, files[0].Bytes.Count);
}
}
}
}