From d5afb2201c88fbd42b304d391ea06c734e46ccf5 Mon Sep 17 00:00:00 2001 From: TekH Date: Mon, 15 Sep 2025 11:18:44 +0200 Subject: [PATCH] refactor(DocSignedNotificationTests): DocSignedNotificationTests aktualisieren, um SendSignedMailHandler zu verwenden MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - SendSignedMailHandler in Testdiensten registrieren - Test1 umbenennen → SendSignedMailHandler_ShouldNotThrow - Sicherstellen, dass die Handler-Ausführung keinen Fehler auslöst --- .../DocSignedNotificationTests.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/EnvelopeGenerator.Tests.Application/DocSignedNotificationTests.cs b/EnvelopeGenerator.Tests.Application/DocSignedNotificationTests.cs index cd035265..81829a57 100644 --- a/EnvelopeGenerator.Tests.Application/DocSignedNotificationTests.cs +++ b/EnvelopeGenerator.Tests.Application/DocSignedNotificationTests.cs @@ -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(); } public override async Task Setup() @@ -20,12 +22,11 @@ public class DocSignedNotificationTests : TestBase _mapper = Host.Services.GetRequiredService(); } - [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(envRcv); - envRcvDto.ToDocSignedNotification(new () { }); + var docSignedNtf = envRcvDto.ToDocSignedNotification(new () { }); - // Act - // create action part + var sendSignedMailHandler = Host.Services.GetRequiredService(); - Assert.Pass(); + // Act + Assert + Assert.DoesNotThrowAsync(async () => await sendSignedMailHandler.Handle(docSignedNtf, cancel)); } }