Add MediatorExtensions tests and refactor CreateEnvelopeCommand
Introduce MediatorExtensionsTests to cover SendOrThrowAsync and SendOrNotFoundAsync extension methods for IMediator, including edge cases and cancellation. Refactor CreateEnvelopeCommand in Fake.cs to use Authorize(userId) instead of setting UserId directly. Add test stubs for IMediator and IRequest to support isolated testing.
This commit is contained in:
@@ -193,13 +193,17 @@ 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)
|
||||
{
|
||||
Message = fake.Lorem.Paragraph(fake.Random.Number(2, 5)),
|
||||
Title = fake.Lorem.Words(fake.Random.Number(3, 4)).Join(" "),
|
||||
UserId = userId,
|
||||
UseSQLExecutor = false
|
||||
};
|
||||
var cmd = new CreateEnvelopeCommand
|
||||
{
|
||||
Message = fake.Lorem.Paragraph(fake.Random.Number(2, 5)),
|
||||
Title = fake.Lorem.Words(fake.Random.Number(3, 4)).Join(" "),
|
||||
UseSQLExecutor = false
|
||||
};
|
||||
cmd.Authorize(userId);
|
||||
return cmd;
|
||||
}
|
||||
|
||||
public static List<CreateEnvelopeCommand> CreateEnvelopeCommands(this Faker fake, params int[] userIDs)
|
||||
=> Enumerable.Range(0, userIDs.Length)
|
||||
|
||||
Reference in New Issue
Block a user