diff --git a/src/SlpModularCms.Core.Tests/Email/MailGoldenTests.cs b/src/SlpModularCms.Core.Tests/Email/MailGoldenTests.cs new file mode 100644 index 0000000..2e9ed9d --- /dev/null +++ b/src/SlpModularCms.Core.Tests/Email/MailGoldenTests.cs @@ -0,0 +1,99 @@ +using System.Text; +using FluentAssertions; +using SlpModularCms.Core.Email; +using Xunit; + +namespace SlpModularCms.Core.Tests.Email; + +/// +/// Characterisation of the rendered mails: every kind, in Dutch and English, with and without the optional parts. The +/// committed files in Golden/mail are the exact output (subject, HTML, plain text). They were recorded from the +/// renderer before its texts moved into the text files and must stay byte-identical: a changed sentence, a lost +/// placeholder or a different encoding shows up here. Regenerate on purpose with UPDATE_GOLDEN=1. +/// +public class MailGoldenTests +{ + private static readonly string[] Languages = ["nl", "en", "fr"]; + + private static MailModel Full(MailKind kind) => new( + SiteName: "Test & Co", + RecipientName: "Jan \"de\" Vries", + ActionUrl: "https://test.example.nl/activate?token=a&b=c", + ValidForMinutes: kind switch + { + MailKind.Invitation => 2880, + MailKind.NewInvitationLink => 60, + MailKind.PasswordReset => 30, + _ => 120, + }, + Detail: "Administrator", + LogoUrl: "https://test.example.nl/logo.png", + BrandColor: "#ac0000", + LogoDarkUrl: "https://test.example.nl/logo-dark.png", + Details: + [ + new MailDetail("Naam", "Jan