Pull Request 33523 suggestions

Pull Request 33520 suggestions

Injected AppSettings instead of using GetEnvironmentVariable at Services level

When debugging only
app.Services.GetRequiredService<IPCRBService>();

Get ready to use VSCode IDE

Align .editorconfig files
This commit is contained in:
2024-12-03 10:48:07 -07:00
parent 08fcd985ea
commit 7be540964a
59 changed files with 2821 additions and 214 deletions

View File

@ -1,12 +1,12 @@
using FabApprovalWorkerService.Clients;
using System.Net.Mail;
using FabApprovalWorkerService.Clients;
using FabApprovalWorkerService.Services;
using Microsoft.Extensions.Logging;
using Moq;
using System.Net.Mail;
namespace FabApprovalWorkerServiceTests;
internal class SmtpServiceTests {
private static readonly List<MailAddress> ADDRESS_LIST = new List<MailAddress>() {
@ -48,7 +48,7 @@ internal class SmtpServiceTests {
_smtpService = new SmtpService(_mockLogger.Object, _mockSmtpClient.Object);
Assert.ThrowsAsync<ArgumentNullException>(async Task () => {
await _smtpService.SendEmail(new List<MailAddress> (), ADDRESS_LIST, "subject", "body");
await _smtpService.SendEmail(new List<MailAddress>(), ADDRESS_LIST, "subject", "body");
});
}
@ -100,13 +100,13 @@ internal class SmtpServiceTests {
[Test]
public async Task SendEmailWithValidArgsShouldSendMailThroughClient() {
_smtpService = new SmtpService(_mockLogger.Object, _mockSmtpClient.Object);
Assert.True(await _smtpService.SendEmail(ADDRESS_LIST, ADDRESS_LIST, "subject", "body"));
bool shouldSendEmail = false;
Boolean.TryParse(Environment.GetEnvironmentVariable("FabApprovalShouldSendEmail"), out shouldSendEmail);
bool.TryParse(Environment.GetEnvironmentVariable("FabApprovalShouldSendEmail"), out shouldSendEmail);
if (shouldSendEmail)
_mockSmtpClient.Verify(s => s.Send(It.IsAny<MailMessage>()));
}
}
}