Refactor email handling for improved structure
Refactored `Email` and `SendingEmailEvent` to use `record` types, consolidating email-related data into the `Email` class. Updated `SendEmailCommand` to return a `Guid` and simplified mapping logic in `EmailMappingProfile`. Adjusted `SendEmailCommandHandler` to construct `SendingEmailEvent` manually. Updated `SendingEmailConsumer`, `EmailsController`, and `EmailSender` to reflect the new structure. Removed the old `Email` implementation. Improved logging to reference the `Mail` property. Revised tests to align with the new structure, ensuring immutability and better separation of concerns.
This commit is contained in:
@@ -77,6 +77,7 @@ public sealed class EmailSenderTests
|
||||
{
|
||||
var email = new Email
|
||||
{
|
||||
Sender = new EmailAccountDto { Username = "test@example.com", Password = "password", SmtpServer = "smtp.example.com" },
|
||||
Recipients = ["hakanttek@gmail.com"],
|
||||
Subject = "EmailSender.Send Integration Test",
|
||||
Body = "<p>Sent via EmailSender static client.</p>",
|
||||
@@ -93,6 +94,7 @@ public sealed class EmailSenderTests
|
||||
{
|
||||
var email = new Email
|
||||
{
|
||||
Sender = new EmailAccountDto { Username = "test@example.com", Password = "password", SmtpServer = "smtp.example.com" },
|
||||
Recipients = ["hakanttek@gmail.com"],
|
||||
Subject = "Plain Text Test",
|
||||
Body = "This is a plain text email.",
|
||||
|
||||
Reference in New Issue
Block a user