Tests: Add tests for documents
This commit is contained in:
20
Tests/DocumentTests/Utils.cs
Normal file
20
Tests/DocumentTests/Utils.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using Elwig.Documents;
|
||||
using NReco.PdfRenderer;
|
||||
|
||||
namespace Tests.DocumentTests {
|
||||
public static class Utils {
|
||||
|
||||
private static readonly string FileName = Path.Combine(Path.GetTempPath(), "test_document.pdf");
|
||||
|
||||
public static async Task<string> GeneratePdfText(Document doc) {
|
||||
await doc.Generate();
|
||||
try {
|
||||
doc.SaveTo(FileName);
|
||||
var conv = new PdfToTextConverter { CustomArgs = "-raw " };
|
||||
return conv.GenerateText(FileName);
|
||||
} finally {
|
||||
File.Delete(FileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user