create faker-extension method for Envelope Commands
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
using Bogus;
|
using Bogus;
|
||||||
using Bogus.DataSets;
|
using Bogus.DataSets;
|
||||||
using EnvelopeGenerator.Application;
|
using EnvelopeGenerator.Application;
|
||||||
|
using EnvelopeGenerator.Application.Envelopes.Commands;
|
||||||
using EnvelopeGenerator.Application.Receivers.Commands;
|
using EnvelopeGenerator.Application.Receivers.Commands;
|
||||||
using EnvelopeGenerator.Infrastructure;
|
using EnvelopeGenerator.Infrastructure;
|
||||||
using MediatR;
|
using MediatR;
|
||||||
@@ -90,6 +91,7 @@ public static class Extensions
|
|||||||
{
|
{
|
||||||
public static Fake.Host ToFake(this IHost host) => new(host);
|
public static Fake.Host ToFake(this IHost host) => new(host);
|
||||||
|
|
||||||
|
#region Receiver Command
|
||||||
public static CreateReceiverCommand CreateReceiverCommand(this Faker fake) => new()
|
public static CreateReceiverCommand CreateReceiverCommand(this Faker fake) => new()
|
||||||
{
|
{
|
||||||
EmailAddress = fake.Internet.Email(),
|
EmailAddress = fake.Internet.Email(),
|
||||||
@@ -99,4 +101,19 @@ public static class Extensions
|
|||||||
=> Enumerable.Range(0, fake.Random.Number(minCount, maxCount))
|
=> Enumerable.Range(0, fake.Random.Number(minCount, maxCount))
|
||||||
.Select(_ => fake.CreateReceiverCommand())
|
.Select(_ => fake.CreateReceiverCommand())
|
||||||
.ToList();
|
.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<CreateEnvelopeCommand> CreateEnvelopeCommands(this Faker fake, params int[] userIDs)
|
||||||
|
=> Enumerable.Range(0, userIDs.Length)
|
||||||
|
.Select(fake.CreateEnvelopeCommand)
|
||||||
|
.ToList();
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user