Enhanced test coverage for RabbitMQ integration by adding: - New package references for dependency injection, logging, and RabbitMQ. - `EmailSenderCollection` and `EmailSenderFixture` for managing static client lifecycle in integration tests. - Integration tests for `EmailSender` and `OutgoingEmailPublisher` to verify connection management, message publishing, and serialization. - `EmailSenderUrlOverloadTests` to validate URL-based connection overload behavior. - `RabbitMqTestConfig` for centralized RabbitMQ test configuration. - Unit tests for URL parsing logic in `EmailSenderUrlParsingTests`. These changes improve reliability, maintainability, and test coverage for the messaging service.
40 lines
1.4 KiB
C#
40 lines
1.4 KiB
C#
using DigitalData.MessagingService.RabbitMQ;
|
|
|
|
namespace DigitalData.MessagingService.Tests;
|
|
|
|
/// <summary>
|
|
/// Shared RabbitMQ connection settings used across integration tests.
|
|
/// Reads from the real broker defined in appsettings.Secrets.json.
|
|
/// </summary>
|
|
internal static class RabbitMqTestConfig
|
|
{
|
|
public const string HostName = "172.24.12.56";
|
|
public const int Port = 5672;
|
|
public const string UserName = "admin";
|
|
public const string Password = "fl!'D}4;pYBb\\VD&{6]]G*\\0Bq8fVIn0j?Sgm\\2A,6GS47g5Dj";
|
|
public const string VirtualHost = "/";
|
|
|
|
public const string QueueName = "emailprofiler.email.outbox";
|
|
public const string ExchangeName = "emailprofiler.emails";
|
|
public const string RoutingKey = "email.outbox";
|
|
public const string DlqQueueName = "emailprofiler.email.outbox.dlq";
|
|
public const string DlqExchangeName = "emailprofiler.emails.dlq";
|
|
public const string DlqRoutingKey = "email.outbox.dlq";
|
|
|
|
public static void Apply(RabbitMqConfiguration cfg)
|
|
{
|
|
cfg.HostName = HostName;
|
|
cfg.Port = Port;
|
|
cfg.UserName = UserName;
|
|
cfg.Password = Password;
|
|
cfg.VirtualHost = VirtualHost;
|
|
cfg.QueueName = QueueName;
|
|
cfg.ExchangeName = ExchangeName;
|
|
cfg.RoutingKey = RoutingKey;
|
|
cfg.DlqQueueName = DlqQueueName;
|
|
cfg.DlqExchangeName = DlqExchangeName;
|
|
cfg.DlqRoutingKey = DlqRoutingKey;
|
|
}
|
|
}
|
|
|