From 582cc1eb1374f77f0d3c53706f34858719a6dbb0 Mon Sep 17 00:00:00 2001 From: TekH Date: Mon, 1 Sep 2025 14:52:49 +0200 Subject: [PATCH] Refactor CreateHistoryCommand and update tests - Simplified `CreateHistoryCommand` method by removing generic type parameters. - Updated `using` directives in `HistoryTests` to include necessary constants. - Revised test method to utilize `Fake.Provider.CreateHistoryCommand` for improved maintainability. --- EnvelopeGenerator.Tests.Application/Fake.cs | 4 +--- EnvelopeGenerator.Tests.Application/HistoryTests.cs | 11 +++-------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/EnvelopeGenerator.Tests.Application/Fake.cs b/EnvelopeGenerator.Tests.Application/Fake.cs index 23c473f3..0889a852 100644 --- a/EnvelopeGenerator.Tests.Application/Fake.cs +++ b/EnvelopeGenerator.Tests.Application/Fake.cs @@ -205,9 +205,7 @@ public static class Extensions #endregion #region History - public static CreateHistoryCommand CreateHistoryCommand(this Faker fake, string key, EnvelopeStatus? status = null) - where TEnvelopeQuery : EnvelopeQueryBase - where TReceiverQuery : ReceiverQueryBase + public static CreateHistoryCommand CreateHistoryCommand(this Faker fake, string key, EnvelopeStatus? status = null) { return new() { diff --git a/EnvelopeGenerator.Tests.Application/HistoryTests.cs b/EnvelopeGenerator.Tests.Application/HistoryTests.cs index 929e1f92..11d051e1 100644 --- a/EnvelopeGenerator.Tests.Application/HistoryTests.cs +++ b/EnvelopeGenerator.Tests.Application/HistoryTests.cs @@ -1,6 +1,6 @@ using EnvelopeGenerator.Application.Histories.Commands; using EnvelopeGenerator.Application.Histories.Queries; -using EnvelopeGenerator.Domain; +using EnvelopeGenerator.Domain.Constants; namespace EnvelopeGenerator.Tests.Application; @@ -26,13 +26,8 @@ public class HistoryTests public async Task CreateHistory_And_ReadHistory_Should_Work() { // Arrange - var createCmd = new CreateHistoryCommand - { - EnvelopeId = 1, - UserReference = "UserA", - Status = EnvelopeStatus.EnvelopeCreated, - Comment = "First create" - }; + var key = string.Empty; + var createCmd = Fake.Provider.CreateHistoryCommand(key); // Act var id = await _host.Mediator.Send(createCmd);