test(notification-outbox): cover Email adapter permanent/cancellation arms, align error casing

This commit is contained in:
Joseph Doherty
2026-05-19 01:32:54 -04:00
parent b8dece0e70
commit 04e00d56c6
2 changed files with 82 additions and 6 deletions

View File

@@ -61,21 +61,21 @@ public sealed class EmailNotificationDeliveryAdapter : INotificationDeliveryAdap
if (list == null)
{
return DeliveryOutcome.Permanent(
$"notification list '{notification.ListName}' not found");
$"Notification list '{notification.ListName}' not found");
}
var recipients = await _repository.GetRecipientsByListIdAsync(list.Id, cancellationToken);
if (recipients.Count == 0)
{
return DeliveryOutcome.Permanent(
$"notification list '{notification.ListName}' has no recipients");
$"Notification list '{notification.ListName}' has no recipients");
}
var smtpConfigs = await _repository.GetAllSmtpConfigurationsAsync(cancellationToken);
var smtpConfig = smtpConfigs.FirstOrDefault();
if (smtpConfig == null)
{
return DeliveryOutcome.Permanent("no SMTP configuration available");
return DeliveryOutcome.Permanent("No SMTP configuration available");
}
// An unknown TLS mode is a configuration error that retrying cannot fix —
@@ -146,7 +146,7 @@ public sealed class EmailNotificationDeliveryAdapter : INotificationDeliveryAdap
_logger.LogError(
"Unclassified failure delivering email to list '{List}' ({ExceptionType}): {Detail}",
notification.ListName, ex.GetType().Name, detail);
return DeliveryOutcome.Permanent($"email delivery failed: {detail}");
return DeliveryOutcome.Permanent($"Email delivery failed: {detail}");
}
}
@@ -227,7 +227,7 @@ public sealed class EmailNotificationDeliveryAdapter : INotificationDeliveryAdap
{
if (!MailboxAddress.TryParse(fromAddress, out _))
{
return $"invalid sender (from) email address: '{fromAddress}'";
return $"Invalid sender (from) email address: '{fromAddress}'";
}
var invalid = recipients
@@ -236,7 +236,7 @@ public sealed class EmailNotificationDeliveryAdapter : INotificationDeliveryAdap
.ToList();
return invalid.Count > 0
? $"invalid recipient email address(es): {string.Join(", ", invalid)}"
? $"Invalid recipient email address(es): {string.Join(", ", invalid)}"
: null;
}