refactor(DocSignedNotificationTests): DocSignedNotificationTests aktualisieren, um SendSignedMailHandler zu verwenden

- SendSignedMailHandler in Testdiensten registrieren
- Test1 umbenennen → SendSignedMailHandler_ShouldNotThrow
- Sicherstellen, dass die Handler-Ausführung keinen Fehler auslöst
This commit is contained in:
tekh 2025-09-15 11:18:44 +02:00
parent 7fbf0ebbfc
commit d5afb2201c

View File

@ -2,6 +2,7 @@
using DigitalData.Core.Abstraction.Application.Repository;
using EnvelopeGenerator.Application.Common.Dto.EnvelopeReceiver;
using EnvelopeGenerator.Application.Common.Notifications.DocSigned;
using EnvelopeGenerator.Application.Common.Notifications.DocSigned.Handlers;
using Microsoft.Extensions.DependencyInjection;
namespace EnvelopeGenerator.Tests.Application;
@ -12,6 +13,7 @@ public class DocSignedNotificationTests : TestBase
protected override void ConfigureServices(IServiceCollection services)
{
services.AddTransient<SendSignedMailHandler>();
}
public override async Task Setup()
@ -20,12 +22,11 @@ public class DocSignedNotificationTests : TestBase
_mapper = Host.Services.GetRequiredService<IMapper>();
}
[TestCase("h.tek@digitaldata.works")]
public async Task Test1(string emailAddress)
[TestCase("h.tek@digitaldata.works", TestName = "SendSignedMailHandler_ShouldNotThrow_WithValidEmail")]
public async Task SendSignedMailHandler_ShouldNotThrow(string emailAddress)
{
CancellationToken cancel = new();
/// Assert
CancellationToken cancel = new();
var mediator = Mediator;
// Create envelope
@ -40,11 +41,11 @@ public class DocSignedNotificationTests : TestBase
var envRcv = this.CreateEnvelopeReceiver(env!.Id, rcv.Id);
envRcv = await Repository.CreateAsync(envRcv, cancel);
var envRcvDto = _mapper.Map<EnvelopeReceiverDto>(envRcv);
envRcvDto.ToDocSignedNotification(new () { });
var docSignedNtf = envRcvDto.ToDocSignedNotification(new () { });
// Act
// create action part
var sendSignedMailHandler = Host.Services.GetRequiredService<SendSignedMailHandler>();
Assert.Pass();
// Act + Assert
Assert.DoesNotThrowAsync(async () => await sendSignedMailHandler.Handle(docSignedNtf, cancel));
}
}