From 094c87eb88139367d7ea8d8c34df234e6f4d87c5 Mon Sep 17 00:00:00 2001 From: TekH Date: Sat, 30 May 2026 16:50:21 +0200 Subject: [PATCH] Refactor CreateEnvelopeCommand and remove ConstantsTests Refactored the `CreateEnvelopeCommand` method in `Fake.cs` to delegate user authentication logic to the `WithAuth` method. Added a new `CreateEnvelopeCommands` method to generate multiple commands for a set of user IDs. Removed `ConstantsTests.cs`, which contained tests for the `Normalize` method of the `EnvelopeSigningType` enumeration, as the method or its tests are no longer relevant. --- EnvelopeGenerator.Tests/Application/Fake.cs | 5 ++--- .../Domain/ConstantsTests.cs | 17 ----------------- 2 files changed, 2 insertions(+), 20 deletions(-) delete mode 100644 EnvelopeGenerator.Tests/Domain/ConstantsTests.cs diff --git a/EnvelopeGenerator.Tests/Application/Fake.cs b/EnvelopeGenerator.Tests/Application/Fake.cs index 66b3e168..9f424b70 100644 --- a/EnvelopeGenerator.Tests/Application/Fake.cs +++ b/EnvelopeGenerator.Tests/Application/Fake.cs @@ -193,13 +193,12 @@ public static class Extensions #endregion #region Envelope - public static CreateEnvelopeCommand CreateEnvelopeCommand(this Faker fake, int userId) => new() + public static CreateEnvelopeCommand CreateEnvelopeCommand(this Faker fake, int userId) => new CreateEnvelopeCommand() { Message = fake.Lorem.Paragraph(fake.Random.Number(2, 5)), Title = fake.Lorem.Words(fake.Random.Number(3, 4)).Join(" "), - UserId = userId, UseSQLExecutor = false - }; + }.WithAuth(userId); public static List CreateEnvelopeCommands(this Faker fake, params int[] userIDs) => Enumerable.Range(0, userIDs.Length) diff --git a/EnvelopeGenerator.Tests/Domain/ConstantsTests.cs b/EnvelopeGenerator.Tests/Domain/ConstantsTests.cs deleted file mode 100644 index 23effd3e..00000000 --- a/EnvelopeGenerator.Tests/Domain/ConstantsTests.cs +++ /dev/null @@ -1,17 +0,0 @@ -using EnvelopeGenerator.Domain.Constants; -using NUnit.Framework; - -namespace EnvelopeGenerator.Tests.Domain; - -public class ConstantsTests -{ - [TestCase(EnvelopeSigningType.ReadAndSign, EnvelopeSigningType.ReadAndSign)] - [TestCase(EnvelopeSigningType.WetSignature, EnvelopeSigningType.WetSignature)] - [TestCase((EnvelopeSigningType)5, EnvelopeSigningType.WetSignature)] - public void Normalize_ReturnsExpectedValue(EnvelopeSigningType input, EnvelopeSigningType expected) - { - var normalized = input.Normalize(); - - Assert.That(normalized, Is.EqualTo(expected)); - } -}