refactor(Extensions): add CreateUserCommand and CreateUserCommands

This commit is contained in:
tekh 2025-08-29 14:37:24 +02:00
parent a7f6b94d20
commit d3e5d3d791

View File

@ -2,6 +2,7 @@
using EnvelopeGenerator.Application;
using EnvelopeGenerator.Application.Envelopes.Commands;
using EnvelopeGenerator.Application.Receivers.Commands;
using EnvelopeGenerator.Application.Users.Commands;
using EnvelopeGenerator.Infrastructure;
using MediatR;
using Microsoft.EntityFrameworkCore;
@ -115,4 +116,20 @@ public static class Extensions
.Select(fake.CreateEnvelopeCommand)
.ToList();
#endregion
#region User Command
public static CreateUserCommand CreateUserCommand(this Faker fake) => new()
{
Prename = fake.Name.FirstName(),
Name = fake.Name.LastName(),
Username = fake.Internet.UserName(),
Shortname = fake.Random.String2(3, 8),
Email = fake.Internet.Email()
};
public static List<CreateUserCommand> CreateUserCommands(this Faker fake, int minCount = 10, int maxCount = 20)
=> Enumerable.Range(0, fake.Random.Number(minCount, maxCount))
.Select(_ => fake.CreateUserCommand())
.ToList();
#endregion
}