From 1c9d0a6c475094e4c519bd9f8d7d56889a11b261 Mon Sep 17 00:00:00 2001 From: TekH Date: Tue, 2 Sep 2025 23:58:35 +0200 Subject: [PATCH] refactor(MappingProfile): update to ignore Envelope, Sender and Receiver --- .../Histories/MappingProfile.cs | 7 +++++-- EnvelopeGenerator.Tests.Application/Fake.cs | 15 +++++++++++++++ .../HistoryTests.cs | 4 ++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/EnvelopeGenerator.Application/Histories/MappingProfile.cs b/EnvelopeGenerator.Application/Histories/MappingProfile.cs index cbd8b3bd..fe9e24c5 100644 --- a/EnvelopeGenerator.Application/Histories/MappingProfile.cs +++ b/EnvelopeGenerator.Application/Histories/MappingProfile.cs @@ -14,6 +14,9 @@ public class MappingProfile: Profile /// public MappingProfile() { - CreateMap(); + CreateMap() + .ForMember(dest => dest.Envelope, opt => opt.Ignore()) + .ForMember(dest => dest.Sender, opt => opt.Ignore()) + .ForMember(dest => dest.Receiver, opt => opt.Ignore()); } -} +} \ No newline at end of file diff --git a/EnvelopeGenerator.Tests.Application/Fake.cs b/EnvelopeGenerator.Tests.Application/Fake.cs index c0245c28..a01aae9e 100644 --- a/EnvelopeGenerator.Tests.Application/Fake.cs +++ b/EnvelopeGenerator.Tests.Application/Fake.cs @@ -225,6 +225,21 @@ public static class Extensions .ToList(); #endregion + #region Envelope Receiver + public static EnvelopeReceiver CreateEnvelopeReceiver(this Faker faker, int envelopeId, int receiverId) => new() + { + EnvelopeId = envelopeId, + ReceiverId = receiverId, + Status = ReceiverStatus.Unsigned, + AddedWhen = DateTime.UtcNow, + AccessCode = faker.Random.Number(1000, 9999).ToString(), + ChangedWhen = DateTime.UtcNow, + CompanyName = faker.Company.CompanyName(), + JobTitle = faker.Name.JobTitle(), + Name = faker.Name.FullName(), + }; + #endregion + #region History public static CreateHistoryCommand CreateHistoryCommand(this Faker fake, string key, EnvelopeStatus? status = null) { diff --git a/EnvelopeGenerator.Tests.Application/HistoryTests.cs b/EnvelopeGenerator.Tests.Application/HistoryTests.cs index 73e9497b..155a4d8b 100644 --- a/EnvelopeGenerator.Tests.Application/HistoryTests.cs +++ b/EnvelopeGenerator.Tests.Application/HistoryTests.cs @@ -35,6 +35,10 @@ public class HistoryTests : TestBase var createReceiverCmd = this.CreateReceiverCommand(); (var receiver, _) = await Mediator.Send(createReceiverCmd); + // Create EnvelopeReceiver + var envRcv = this.CreateEnvelopeReceiver(envelope.Id, receiver.Id); + envRcv = await GetRepository().CreateAsync(envRcv, cancel); + var key = (envelope.Uuid, receiver.Signature).ToEnvelopeKey(); var createCmd = Fake.Provider.CreateHistoryCommand(key);