(() =>
EmailSender.ConnectRabbitMq(
ValidUrl,
RabbitMqTestConfig.UserName,
RabbitMqTestConfig.Password,
OnReconnect.ThrowException));
}
[Fact]
public void ConnectRabbitMq_UrlOverload_WithVHostInPath_WithIgnore_DoesNotThrow()
{
var exception = Record.Exception(() =>
EmailSender.ConnectRabbitMq(
ValidUrlWithVHost,
RabbitMqTestConfig.UserName,
RabbitMqTestConfig.Password,
OnReconnect.Ignore));
Assert.Null(exception);
}
[Fact]
public void Send_AfterUrlOverloadConnection_DoesNotThrow()
{
var email = new OutgoingEmailEvent
{
Id = Guid.NewGuid(),
Recipient = "url-overload-test@example.com",
Subject = "URL Overload Integration Test",
Body = "Sent after URL-based connection.
",
IsHtml = true,
QueuedAt = DateTime.Now
};
// Connection was established via Action<> overload in the fixture;
// Send should work regardless of which overload was used to connect.
var exception = Record.Exception(() => EmailSender.Send(email));
Assert.Null(exception);
}
}