Corrected tests

This commit is contained in:
Chase Tucker
2024-05-14 10:40:06 -07:00
committed by Tucker Chase (IT FI MES)
parent 7acd6ce0f2
commit 4338eab9aa

View File

@ -10,7 +10,7 @@ using System.Net.Mail;
namespace FabApprovalWorkerServiceTests;
internal class SmtpServiceTests {
private static readonly List<MailAddress> ADDRESS_LIST = new List<MailAddress>() {
new MailAddress("fake@email.com")
new MailAddress("chase.tucker@infineon.com")
};
private Mock<ILogger<SmtpService>> _mockLogger;
@ -103,9 +103,10 @@ internal class SmtpServiceTests {
Assert.True(await _smtpService.SendEmail(ADDRESS_LIST, ADDRESS_LIST, "subject", "body"));
string? env = Environment.GetEnvironmentVariable("FabApprovalEnvironmentName");
bool shouldSendEmail = false;
Boolean.TryParse(Environment.GetEnvironmentVariable("FabApprovalShouldSendEmail"), out shouldSendEmail);
if (env is not null && !env.ToLower().Equals("development"))
if (shouldSendEmail)
_mockSmtpClient.Verify(s => s.Send(It.IsAny<MailMessage>()));
}
}