Corrected tests
This commit is contained in:
committed by
Tucker Chase (IT FI MES)
parent
7acd6ce0f2
commit
4338eab9aa
@ -10,7 +10,7 @@ using System.Net.Mail;
|
|||||||
namespace FabApprovalWorkerServiceTests;
|
namespace FabApprovalWorkerServiceTests;
|
||||||
internal class SmtpServiceTests {
|
internal class SmtpServiceTests {
|
||||||
private static readonly List<MailAddress> ADDRESS_LIST = new List<MailAddress>() {
|
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;
|
private Mock<ILogger<SmtpService>> _mockLogger;
|
||||||
@ -103,9 +103,10 @@ internal class SmtpServiceTests {
|
|||||||
|
|
||||||
Assert.True(await _smtpService.SendEmail(ADDRESS_LIST, ADDRESS_LIST, "subject", "body"));
|
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>()));
|
_mockSmtpClient.Verify(s => s.Send(It.IsAny<MailMessage>()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user