();
- publisher.EnqueueAsync(email.ToEvent());
+ publisher.EnqueueAsync(new SendingEmailEvent()
+ {
+ Id = Guid.NewGuid(),
+ Mail = email,
+ QueuedAt = DateTime.Now
+ });
}
}
\ No newline at end of file
diff --git a/tests/DigitalData.MessagingService.Tests/Integration/EmailSenderTests.cs b/tests/DigitalData.MessagingService.Tests/Integration/EmailSenderTests.cs
index b69df3f..13ba0a9 100644
--- a/tests/DigitalData.MessagingService.Tests/Integration/EmailSenderTests.cs
+++ b/tests/DigitalData.MessagingService.Tests/Integration/EmailSenderTests.cs
@@ -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 = "Sent via EmailSender static client.
",
@@ -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.",
diff --git a/tests/DigitalData.MessagingService.Tests/Integration/EmailSenderUrlOverloadTests.cs b/tests/DigitalData.MessagingService.Tests/Integration/EmailSenderUrlOverloadTests.cs
index a145eff..46abc8e 100644
--- a/tests/DigitalData.MessagingService.Tests/Integration/EmailSenderUrlOverloadTests.cs
+++ b/tests/DigitalData.MessagingService.Tests/Integration/EmailSenderUrlOverloadTests.cs
@@ -57,6 +57,7 @@ public sealed class EmailSenderUrlOverloadTests
{
var email = new Email
{
+ Sender = new EmailAccountDto { Username = "test@example.com", Password = "password", SmtpServer = "smtp.example.com" },
Recipients = ["url-overload-test@example.com"],
Subject = "URL Overload Integration Test",
Body = "Sent after URL-based connection.
",
diff --git a/tests/DigitalData.MessagingService.Tests/Integration/SendingEmailPublisherTests.cs b/tests/DigitalData.MessagingService.Tests/Integration/SendingEmailPublisherTests.cs
index b4fd0d7..506c4ff 100644
--- a/tests/DigitalData.MessagingService.Tests/Integration/SendingEmailPublisherTests.cs
+++ b/tests/DigitalData.MessagingService.Tests/Integration/SendingEmailPublisherTests.cs
@@ -37,10 +37,14 @@ public sealed class SendingEmailPublisherTests : IAsyncDisposable
var email = new SendingEmailEvent
{
Id = Guid.NewGuid(),
- Recipients = ["test@example.com"],
- Subject = "Integration Test - EnqueueAsync",
- Body = "Hello from integration test.
",
- IsHtml = true,
+ Mail = new Email
+ {
+ Sender = new EmailAccountDto { Username = "test@example.com", Password = "password", SmtpServer = "smtp.example.com" },
+ Recipients = ["test@example.com"],
+ Subject = "Integration Test - EnqueueAsync",
+ Body = "Hello from integration test.
",
+ IsHtml = true,
+ },
QueuedAt = DateTime.Now
};
@@ -62,10 +66,14 @@ public sealed class SendingEmailPublisherTests : IAsyncDisposable
var emails = Enumerable.Range(1, 3).Select(i => new SendingEmailEvent
{
Id = Guid.NewGuid(),
- Recipients = new List { $"recipient{i}@example.com" },
- Subject = $"Integration Test - Batch #{i}",
- Body = $"Batch message {i}",
- IsHtml = false,
+ Mail = new Email
+ {
+ Sender = new EmailAccountDto { Username = "test@example.com", Password = "password", SmtpServer = "smtp.example.com" },
+ Recipients = new List { $"recipient{i}@example.com" },
+ Subject = $"Integration Test - Batch #{i}",
+ Body = $"Batch message {i}",
+ IsHtml = false,
+ },
QueuedAt = DateTime.Now
}).ToList();
@@ -85,10 +93,14 @@ public sealed class SendingEmailPublisherTests : IAsyncDisposable
var email = new SendingEmailEvent
{
Id = Guid.NewGuid(),
- Recipients = ["depth-test@example.com"],
- Subject = "Integration Test - GetQueueDepth",
- Body = "Queue depth test",
- IsHtml = false,
+ Mail = new Email
+ {
+ Sender = new EmailAccountDto { Username = "test@example.com", Password = "password", SmtpServer = "smtp.example.com" },
+ Recipients = ["depth-test@example.com"],
+ Subject = "Integration Test - GetQueueDepth",
+ Body = "Queue depth test",
+ IsHtml = false,
+ },
QueuedAt = DateTime.Now
};
@@ -108,10 +120,14 @@ public sealed class SendingEmailPublisherTests : IAsyncDisposable
var email = new SendingEmailEvent
{
Id = id,
- Recipients = new List { "serialize@example.com" },
- Subject = "Serialization Test",
- Body = "Bold",
- IsHtml = true,
+ Mail = new Email
+ {
+ Sender = new EmailAccountDto { Username = "test@example.com", Password = "password", SmtpServer = "smtp.example.com" },
+ Recipients = new List { "serialize@example.com" },
+ Subject = "Serialization Test",
+ Body = "Bold",
+ IsHtml = true,
+ },
QueuedAt = DateTime.Now
};
@@ -123,10 +139,10 @@ public sealed class SendingEmailPublisherTests : IAsyncDisposable
Assert.NotNull(received);
Assert.Equal(id, received.Id);
- Assert.Equal(["serialize@example.com"], received.Recipients);
- Assert.Equal("Serialization Test", received.Subject);
- Assert.Equal("Bold", received.Body);
- Assert.True(received.IsHtml);
+ Assert.Equal(["serialize@example.com"], received.Mail.Recipients);
+ Assert.Equal("Serialization Test", received.Mail.Subject);
+ Assert.Equal("Bold", received.Mail.Body);
+ Assert.True(received.Mail.IsHtml);
}
///