[ADD] adding non regression unit test to cover PR 473

This commit is contained in:
Mathieu jolivet 2022-12-08 14:38:19 +01:00
parent 9c9c7c99ea
commit 998e768bba
2 changed files with 54 additions and 0 deletions

View File

@ -0,0 +1,54 @@
namespace UglyToad.PdfPig.Tests.Integration;
using System.Linq;
using Xunit;
public class IndexedPageSummaryFileTests
{
private static string GetFilename()
{
return IntegrationHelpers.GetDocumentPath("FICTIF_TABLE_INDEX.pdf");
}
[Fact]
public void HasCorrectNumberOfPages()
{
using (var document = PdfDocument.Open(GetFilename()))
{
Assert.Equal(14, document.NumberOfPages);
}
}
[Fact]
public void GetPagesWorks()
{
using (var document = PdfDocument.Open(GetFilename()))
{
var pageCount = document.GetPages().Count();
Assert.Equal(14, pageCount);
}
}
[Theory]
[InlineData("M. HERNANDEZ DANIEL", 1)]
[InlineData("M. HERNANDEZ DANIEL", 2)]
[InlineData("Mme ALIBERT CHLOE AA", 3)]
[InlineData("Mme ALIBERT CHLOE AA", 4)]
[InlineData("M. SIMPSON BART AAA", 5)]
[InlineData("M. SIMPSON BART AAA", 6)]
[InlineData("M. BOND JAMES A", 7)]
[InlineData("M. BOND JAMES A", 8)]
[InlineData("M. DE BALZAC HONORE", 9)]
[InlineData("M. DE BALZAC HONORE", 10)]
[InlineData("M. STALLONE SILVESTER", 11)]
[InlineData("M. STALLONE SILVESTER", 12)]
[InlineData("M. SCOTT MICHAEL", 13)]
[InlineData("M. SCOTT MICHAEL", 14)]
public void CheckSpecificNamesPresence_InIndexedPageNumbersFile(string searchedName, int pageNumber)
{
using var document = PdfDocument.Open(GetFilename());
var page = document.GetPage(pageNumber);
Assert.Contains(searchedName, page.Text);
}
}