using Elwig.Documents;
using Elwig.Helpers;

namespace Tests.UnitTests.DocumentTests {
    [TestFixture]
    public class MemberDataSheetTest {

        [Test]
        public async Task Test_01_SimpleMember() {
            using var ctx = new AppDbContext();
            var m = await ctx.Members.FindAsync(104);
            using var doc = new MemberDataSheet(m!, ctx);
            var text = await Utils.GeneratePdfText(doc);
            Assert.Multiple(() => {
                Assert.That(text, Contains.Substring("""
                    WINZER Waltraud
                    Wiener Straße 15
                    2120 Wolkersdorf im Weinviertel
                    """));
                Assert.That(text, Contains.Substring("Stammdatenblatt WINZER Waltraud"));
                Assert.That(text, Contains.Substring("""
                    Titel (vorangestellt) Vorname Nachname Titel (nachgestellt)
                    Waltraud Winzer
                    """));
                Assert.That(text, Contains.Substring("Mitglieds-Nr.: 104"));
                Assert.That(text, Contains.Substring("Adresse: Wiener Straße 15"));
                Assert.That(text, Contains.Substring("PLZ/Ort: 2120 Wolkersdorf im Weinviertel (Wolkersdorf im Weinviertel)"));
                Assert.That(text, Contains.Substring("Adresse: Wiener Straße 15"));
                Assert.That(text, Contains.Substring("""
                    Rechnungsadresse (optional)
                    Name: Weinbau Waltraud Winzer GmbH
                    Adresse: Hauptstraße 1
                    PLZ/Ort: 2122 Riedenthal (Riedenthal)
                    """));
                Assert.That(text, Contains.Substring("IBAN: AT97 1234 5678 9012 3460"));
                Assert.That(text, Contains.Substring("Betriebs-Nr.: 0123498"));
                Assert.That(text, Contains.Substring("Stammgemeinde: Wolkersdorf"));
            });
        }
    }
}
