Refactor CreateHistoryCommand and update tests
- Simplified `CreateHistoryCommand` method by removing generic type parameters. - Updated `using` directives in `HistoryTests` to include necessary constants. - Revised test method to utilize `Fake.Provider.CreateHistoryCommand` for improved maintainability.
This commit is contained in:
@@ -205,9 +205,7 @@ public static class Extensions
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region History
|
#region History
|
||||||
public static CreateHistoryCommand CreateHistoryCommand<TEnvelopeQuery, TReceiverQuery>(this Faker fake, string key, EnvelopeStatus? status = null)
|
public static CreateHistoryCommand CreateHistoryCommand(this Faker fake, string key, EnvelopeStatus? status = null)
|
||||||
where TEnvelopeQuery : EnvelopeQueryBase
|
|
||||||
where TReceiverQuery : ReceiverQueryBase
|
|
||||||
{
|
{
|
||||||
return new()
|
return new()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using EnvelopeGenerator.Application.Histories.Commands;
|
using EnvelopeGenerator.Application.Histories.Commands;
|
||||||
using EnvelopeGenerator.Application.Histories.Queries;
|
using EnvelopeGenerator.Application.Histories.Queries;
|
||||||
using EnvelopeGenerator.Domain;
|
using EnvelopeGenerator.Domain.Constants;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Tests.Application;
|
namespace EnvelopeGenerator.Tests.Application;
|
||||||
|
|
||||||
@@ -26,13 +26,8 @@ public class HistoryTests
|
|||||||
public async Task CreateHistory_And_ReadHistory_Should_Work()
|
public async Task CreateHistory_And_ReadHistory_Should_Work()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var createCmd = new CreateHistoryCommand
|
var key = string.Empty;
|
||||||
{
|
var createCmd = Fake.Provider.CreateHistoryCommand(key);
|
||||||
EnvelopeId = 1,
|
|
||||||
UserReference = "UserA",
|
|
||||||
Status = EnvelopeStatus.EnvelopeCreated,
|
|
||||||
Comment = "First create"
|
|
||||||
};
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var id = await _host.Mediator.Send(createCmd);
|
var id = await _host.Mediator.Send(createCmd);
|
||||||
|
|||||||
Reference in New Issue
Block a user