test: enhance DocSignedNotificationTests with AutoMapper and notification mapping

This commit is contained in:
tekh 2025-09-15 10:48:25 +02:00
parent 796c59cd38
commit cb0c361cdb
2 changed files with 16 additions and 6 deletions

View File

@ -1,15 +1,23 @@
using DigitalData.Core.Abstraction.Application; using AutoMapper;
using DigitalData.Core.Abstraction.Application.Repository; 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 EnvelopeGenerator.Domain.Entities; using EnvelopeGenerator.Domain.Entities;
using Microsoft.Extensions.DependencyInjection;
using System.Dynamic;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace EnvelopeGenerator.Tests.Application; namespace EnvelopeGenerator.Tests.Application;
public class DocSignedNotificationTests : TestBase public class DocSignedNotificationTests : TestBase
{ {
[SetUp] protected IMapper _mapper;
public void Setup()
public override Task Setup()
{ {
return base.Setup();
_mapper = Host.Services.GetRequiredService<IMapper>();
} }
[TestCase("h.tek@digitaldata.works")] [TestCase("h.tek@digitaldata.works")]
@ -30,10 +38,12 @@ public class DocSignedNotificationTests : TestBase
// Create envelope receiver // Create envelope receiver
var envRcv = this.CreateEnvelopeReceiver(env!.Id, rcv.Id); var envRcv = this.CreateEnvelopeReceiver(env!.Id, rcv.Id);
await Repository.CreateAsync<EnvelopeReceiver>(envRcv, cancel); envRcv = await Repository.CreateAsync(envRcv, cancel);
var envRcvDto = _mapper.Map<EnvelopeReceiverDto>(envRcv);
envRcvDto.ToDocSignedNotification(new () { });
// Act // Act
// create action part
Assert.Pass(); Assert.Pass();
} }

View File

@ -10,7 +10,7 @@ namespace EnvelopeGenerator.Tests.Application;
public class TestBase : Faker public class TestBase : Faker
{ {
private Fake.Host Host; protected Fake.Host Host;
protected User User => Host.User; protected User User => Host.User;