Tests: Use Assert.EnterMultipleScope instead of Assert.Multiple
Test / Run tests (push) Successful in 2m6s

This commit is contained in:
2026-06-29 02:33:36 +02:00
parent fcd0555e4d
commit 69efca1cc3
18 changed files with 243 additions and 242 deletions
+7 -5
View File
@@ -4,10 +4,13 @@ using NReco.PdfRenderer;
using System.Text.RegularExpressions;
namespace Tests.UnitTests.DocumentTests {
public static class Utils {
public static partial class Utils {
private static readonly string FileName = Path.Combine(Path.GetTempPath(), "test_document.pdf");
[GeneratedRegex(@"\s{2,}")]
private static partial Regex WideSpaces();
public static async Task<string> GeneratePdfText(Document doc, bool preserveLayout = false) {
using (var ctx = new AppDbContext()) {
await doc.Generate(ctx);
@@ -22,11 +25,10 @@ namespace Tests.UnitTests.DocumentTests {
}
public static string[][] ExtractTable(string text) {
return text.Split('\n')
.Select(row => Regex.Split(row, @"\s{2,}").Select(c => c.Trim()).Where(c => c.Length > 0).ToArray())
return [.. text.Split('\n')
.Select(row => WideSpaces().Split(row).Select(c => c.Trim()).Where(c => c.Length > 0).ToArray())
.Where(row => row.Length >= 3)
.Skip(1)
.ToArray();
.Skip(1)];
}
}
}