Tests: Fix flaky tests when extracting table
All checks were successful
Test / Run tests (push) Successful in 2m10s

This commit is contained in:
2024-07-19 10:49:21 +02:00
parent 5a36e84b1f
commit 01d658f51d
2 changed files with 2 additions and 2 deletions

View File

@ -19,7 +19,7 @@ namespace Tests.DocumentTests {
Assert.That(table.Take(3), Is.EqualTo(new string[][] { Assert.That(table.Take(3), Is.EqualTo(new string[][] {
["101 MUSTERMANN Max", "Winzerstraße 1", "2223", "Hohenruppersdorf", "0123463", "0", "Hohenruppersdorf"], ["101 MUSTERMANN Max", "Winzerstraße 1", "2223", "Hohenruppersdorf", "0123463", "0", "Hohenruppersdorf"],
["102 WEINBAUER Wernhardt", "Winzerstraße 2", "2223", "Hohenruppersdorf", "0123471", "0", "Hohenruppersdorf"], ["102 WEINBAUER Wernhardt", "Winzerstraße 2", "2223", "Hohenruppersdorf", "0123471", "0", "Hohenruppersdorf"],
["", "W&B Weinbauer GesbR", "Winzerstraße 2", "2223", "Hohenruppersdorf"], [ "W&B Weinbauer GesbR", "Winzerstraße 2", "2223", "Hohenruppersdorf"],
})); }));
}); });
} }

View File

@ -20,7 +20,7 @@ namespace Tests.DocumentTests {
public static string[][] ExtractTable(string text) { public static string[][] ExtractTable(string text) {
return text.Split('\n') return text.Split('\n')
.Select(row => Regex.Split(row, @"\s{2,}").Select(c => c.Trim()).ToArray()) .Select(row => Regex.Split(row, @"\s{2,}").Select(c => c.Trim()).Where(c => c.Length > 0).ToArray())
.Where(row => row.Length > 3) .Where(row => row.Length > 3)
.Skip(1) .Skip(1)
.ToArray(); .ToArray();