Tests: Add WineQualityStatisticsTest

This commit is contained in:
2024-03-30 11:09:39 +01:00
parent 5c3cf41d3d
commit 657910ff48

View File

@ -0,0 +1,45 @@
using Elwig.Documents;
using Elwig.Helpers;
using Elwig.Models.Dtos;
namespace Tests.DocumentTests {
[TestFixture]
public class QualityStatisticsTest {
[Test]
public async Task Test_01_AllDeliveries2020() {
using var ctx = new AppDbContext();
var data = await WineQualityStatisticsData.FromQuery(ctx.Deliveries.Where(d => d.Year == 2020).SelectMany(d => d.Parts));
using var doc = new WineQualityStatistics("Saison 2020", data);
var text = await Utils.GeneratePdfText(doc);
Assert.Multiple(() => {
Assert.That(text, Contains.Substring("Qualitätsstatistik"));
Assert.That(text, Contains.Substring("Saison 2020"));
Assert.That(text, Contains.Substring("""
Qualitätswein
73 2 4 431
74 2 4 203
75 3 5 176
77 1 842
78 1 2 901
79 1 1 280
80 1 3 198
82 1 4 002
"""));
Assert.That(text, Contains.Substring("""
Kabinett
84 3 8 960
85 3 11 181
86 1 2 987
87 2 5 002
89 2 4 723
"""));
Assert.That(text, Contains.Substring(
"- 0 0 " +
"- 0 0 " +
"77 12 " + "26 033 " +
"86 11 " + "32 853"));
});
}
}
}