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 EnvelopeGenerator.Application.Common.Dto.EnvelopeReceiver;
using EnvelopeGenerator.Application.Common.Notifications.DocSigned;
using EnvelopeGenerator.Application.Common.Notifications.DocSigned.Handlers;
using EnvelopeGenerator.Domain.Entities;
using Microsoft.Extensions.DependencyInjection;
using System.Dynamic;
using System.Threading.Tasks;
namespace EnvelopeGenerator.Tests.Application;
public class DocSignedNotificationTests : TestBase
{
[SetUp]
public void Setup()
protected IMapper _mapper;
public override Task Setup()
{
return base.Setup();
_mapper = Host.Services.GetRequiredService<IMapper>();
}
[TestCase("h.tek@digitaldata.works")]
@ -30,10 +38,12 @@ public class DocSignedNotificationTests : TestBase
// Create envelope receiver
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
// create action part
Assert.Pass();
}

View File

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