Tests: Add DeliveryConfirmationTest
This commit is contained in:
44
Tests/DocumentTests/DeliveryConfirmationTest.cs
Normal file
44
Tests/DocumentTests/DeliveryConfirmationTest.cs
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
using Elwig.Documents;
|
||||||
|
using Elwig.Helpers;
|
||||||
|
using Elwig.Models.Dtos;
|
||||||
|
|
||||||
|
namespace Tests.DocumentTests {
|
||||||
|
[TestFixture]
|
||||||
|
public class DeliveryConfirmationTest {
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task Test_01_SimpleDeliveryConfirmation() {
|
||||||
|
using var ctx = new AppDbContext();
|
||||||
|
var m = await ctx.Members.FindAsync(101);
|
||||||
|
var data = await DeliveryConfirmationDeliveryData.ForMember(ctx.DeliveryParts, 2020, m!);
|
||||||
|
using var doc = new DeliveryConfirmation(ctx, 2020, m!, data);
|
||||||
|
var text = await Utils.GeneratePdfText(doc);
|
||||||
|
Assert.Multiple(() => {
|
||||||
|
Assert.That(text, Contains.Substring("""
|
||||||
|
MUSTERMANN Max
|
||||||
|
Winzerstraße 1
|
||||||
|
2223 Hohenruppersdorf
|
||||||
|
"""));
|
||||||
|
Assert.That(text, Contains.Substring("1472583")); // Betriebsnummer
|
||||||
|
Assert.That(text, Contains.Substring("pauschaliert"));
|
||||||
|
Assert.That(text, Contains.Substring($"Wolkersdorf, am {DateTime.Now:dd.MM.yyyy}"));
|
||||||
|
Assert.That(text, Contains.Substring("Anlieferungsbestätigung 2020"));
|
||||||
|
Assert.That(text, Contains.Substring("""
|
||||||
|
20201001X003 2 Grüner Veltliner Kabinett Kabinett 87 17,6
|
||||||
|
20201001X003 3 Grüner Veltliner Qualitätswein 79 16,1
|
||||||
|
20201001X003 1 Grüner Veltliner Qualitätswein 75 15,4
|
||||||
|
20201001X001 1 Grüner Veltliner Qualitätswein 73 15,0
|
||||||
|
20201001X005 2 Welschriesling Kabinett 84 17,1
|
||||||
|
20201001X005 1 Welschriesling Kabinett 84 17,0
|
||||||
|
"""));
|
||||||
|
Assert.That(text, Contains.Substring("Gesamt: 15 571"));
|
||||||
|
Assert.That(text, Contains.Substring("""
|
||||||
|
Sortenaufteilung [kg] ohne Attr./Bewirt. Kabinett Gesamt
|
||||||
|
Grüner Veltliner 7 060 3 129 10 189
|
||||||
|
Welschriesling 5 382 - 5 382
|
||||||
|
12 442 3 129 15 571
|
||||||
|
"""));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user