From 777f20eddbd3d97b8cee5548dd07f93c5b890f28 Mon Sep 17 00:00:00 2001 From: TekH Date: Fri, 29 Aug 2025 14:00:00 +0200 Subject: [PATCH] create faker-extension method for Envelope Commands --- EnvelopeGenerator.Tests.Application/Fake.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/EnvelopeGenerator.Tests.Application/Fake.cs b/EnvelopeGenerator.Tests.Application/Fake.cs index 46e8d336..f2314424 100644 --- a/EnvelopeGenerator.Tests.Application/Fake.cs +++ b/EnvelopeGenerator.Tests.Application/Fake.cs @@ -1,6 +1,7 @@ using Bogus; using Bogus.DataSets; using EnvelopeGenerator.Application; +using EnvelopeGenerator.Application.Envelopes.Commands; using EnvelopeGenerator.Application.Receivers.Commands; using EnvelopeGenerator.Infrastructure; using MediatR; @@ -90,6 +91,7 @@ public static class Extensions { public static Fake.Host ToFake(this IHost host) => new(host); + #region Receiver Command public static CreateReceiverCommand CreateReceiverCommand(this Faker fake) => new() { EmailAddress = fake.Internet.Email(), @@ -99,4 +101,19 @@ public static class Extensions => Enumerable.Range(0, fake.Random.Number(minCount, maxCount)) .Select(_ => fake.CreateReceiverCommand()) .ToList(); + #endregion + + #region Envelope Command + public static CreateEnvelopeCommand CreateEnvelopeCommand(this Faker fake, int userId) => new() + { + Message = fake.Lorem.Paragraph(fake.Random.Number(2, 5)), + Title = fake.Lorem.Paragraph(fake.Random.Number(1, 2)), + UserId = userId + }; + + public static List CreateEnvelopeCommands(this Faker fake, params int[] userIDs) + => Enumerable.Range(0, userIDs.Length) + .Select(fake.CreateEnvelopeCommand) + .ToList(); + #endregion } \ No newline at end of file