2757869176
Add contract validation, SMTP delivery results, terminal failure context, neutral development seeding, and local Docker setup. Ref: IT-1033
31 lines
1.1 KiB
C#
31 lines
1.1 KiB
C#
namespace HrynCo.NotificationService.Services.Tests.EmailProcessing;
|
|
|
|
using HrynCo.NotificationService.DAL.Abstract.Repositories;
|
|
using HrynCo.NotificationService.Worker.Services.EmailProcessing;
|
|
using NSubstitute;
|
|
|
|
public sealed class EmailTemplateServiceTests
|
|
{
|
|
[Fact]
|
|
public async Task GetAsync_WhenRequestedLanguageDoesNotExist_DoesNotSilentlyFallback()
|
|
{
|
|
IEmailTemplateRepository repository = Substitute.For<IEmailTemplateRepository>();
|
|
var service = new EmailTemplateService(repository);
|
|
|
|
InvalidOperationException exception = await Assert.ThrowsAsync<InvalidOperationException>(
|
|
() => service.GetAsync("StoreMate-Prod", "EmailVerification", "UK", CancellationToken.None));
|
|
|
|
Assert.Contains("language='uk'", exception.Message);
|
|
await repository.Received(1).GetAsync(
|
|
"StoreMate-Prod",
|
|
"EmailVerification",
|
|
"uk",
|
|
CancellationToken.None);
|
|
await repository.DidNotReceive().GetAsync(
|
|
"StoreMate-Prod",
|
|
"EmailVerification",
|
|
"en",
|
|
Arg.Any<CancellationToken>());
|
|
}
|
|
}
|