Refactor Email to EmailContext across codebase

Replaced the `Email` record with the new `EmailContext` record to introduce additional context and functionality in email handling. Updated property definitions to distinguish between .NET Framework (`set`) and other frameworks (`init`).

Modified `SendingEmailEvent` to use `EmailContext` for the `Mail` property. Updated mappings in `EmailMappingProfile` to map `SendEmailCommand` to `EmailContext`. Adjusted `SendEmailCommandHandler` to use `EmailContext` when mapping requests.

Refactored `EmailSender` to use `EmailContext` in its `Send` method, including updates to method signatures and documentation. Updated all related test classes (`EmailSenderTests`, `EmailSenderUrlOverloadTests`, `SendingEmailPublisherTests`) to validate the behavior of `EmailContext`, ensuring consistency and thorough testing of the transition.

These changes ensure compatibility across frameworks and improve the maintainability of the email handling process.
This commit is contained in:
2026-08-05 14:06:41 +02:00
parent c6e67c0f99
commit 3cd8841e80
8 changed files with 14 additions and 14 deletions

View File

@@ -37,7 +37,7 @@ public sealed class SendingEmailPublisherTests : IAsyncDisposable
var email = new SendingEmailEvent
{
Id = Guid.NewGuid(),
Mail = new Email
Mail = new EmailContext
{
Sender = new EmailAccountDto { Username = "test@example.com", Password = "password", SmtpServer = "smtp.example.com" },
Recipients = ["test@example.com"],
@@ -66,7 +66,7 @@ public sealed class SendingEmailPublisherTests : IAsyncDisposable
var emails = Enumerable.Range(1, 3).Select(i => new SendingEmailEvent
{
Id = Guid.NewGuid(),
Mail = new Email
Mail = new EmailContext
{
Sender = new EmailAccountDto { Username = "test@example.com", Password = "password", SmtpServer = "smtp.example.com" },
Recipients = new List<string> { $"recipient{i}@example.com" },
@@ -93,7 +93,7 @@ public sealed class SendingEmailPublisherTests : IAsyncDisposable
var email = new SendingEmailEvent
{
Id = Guid.NewGuid(),
Mail = new Email
Mail = new EmailContext
{
Sender = new EmailAccountDto { Username = "test@example.com", Password = "password", SmtpServer = "smtp.example.com" },
Recipients = ["depth-test@example.com"],
@@ -120,7 +120,7 @@ public sealed class SendingEmailPublisherTests : IAsyncDisposable
var email = new SendingEmailEvent
{
Id = id,
Mail = new Email
Mail = new EmailContext
{
Sender = new EmailAccountDto { Username = "test@example.com", Password = "password", SmtpServer = "smtp.example.com" },
Recipients = new List<string> { "serialize@example.com" },