test(history): Aktualisieren Sie HistoryTests, um die Erstellung von Umschlägen auf Repository-Basis zu verwenden.
This commit is contained in:
parent
6cdd1db7a9
commit
c67bac3e16
@ -2,6 +2,7 @@
|
|||||||
using EnvelopeGenerator.Application.Histories.Commands;
|
using EnvelopeGenerator.Application.Histories.Commands;
|
||||||
using EnvelopeGenerator.Application.Histories.Queries;
|
using EnvelopeGenerator.Application.Histories.Queries;
|
||||||
using EnvelopeGenerator.Domain.Constants;
|
using EnvelopeGenerator.Domain.Constants;
|
||||||
|
using EnvelopeGenerator.Domain.Entities;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Tests.Application;
|
namespace EnvelopeGenerator.Tests.Application;
|
||||||
|
|
||||||
@ -24,9 +25,11 @@ public class HistoryTests : TestBase
|
|||||||
public async Task CreateHistory_And_ReadHistory_Should_Work()
|
public async Task CreateHistory_And_ReadHistory_Should_Work()
|
||||||
{
|
{
|
||||||
/// Arrange
|
/// Arrange
|
||||||
|
CancellationToken cancel = default;
|
||||||
|
|
||||||
// Create envelope
|
// Create envelope
|
||||||
var createEnvelopeCmd = FakeCreateEnvelopeCommand;
|
var envelope = FakeEnvelope;
|
||||||
var envelope = await Mediator.Send(createEnvelopeCmd).ThrowIfNull(Exceptions.NotFound);
|
envelope = await GetRepository<Envelope>().CreateAsync(envelope, cancel);
|
||||||
|
|
||||||
// Create receiver
|
// Create receiver
|
||||||
var createReceiverCmd = this.CreateReceiverCommand();
|
var createReceiverCmd = this.CreateReceiverCommand();
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using Bogus;
|
using Bogus;
|
||||||
|
using DigitalData.Core.Abstraction.Application.Repository;
|
||||||
using DigitalData.UserManager.Domain.Entities;
|
using DigitalData.UserManager.Domain.Entities;
|
||||||
using EnvelopeGenerator.Application.Envelopes.Commands;
|
using EnvelopeGenerator.Application.Envelopes.Commands;
|
||||||
using EnvelopeGenerator.Domain.Entities;
|
using EnvelopeGenerator.Domain.Entities;
|
||||||
@ -10,13 +11,15 @@ public class TestBase : Faker
|
|||||||
{
|
{
|
||||||
private Fake.Host Host;
|
private Fake.Host Host;
|
||||||
|
|
||||||
public User User => Host.User;
|
protected User User => Host.User;
|
||||||
|
|
||||||
public IMediator Mediator => Host.Mediator;
|
protected IMediator Mediator => Host.Mediator;
|
||||||
|
|
||||||
public CreateEnvelopeCommand FakeCreateEnvelopeCommand => this.CreateEnvelopeCommand(Host.User.Id);
|
protected CreateEnvelopeCommand FakeCreateEnvelopeCommand => this.CreateEnvelopeCommand(Host.User.Id);
|
||||||
|
|
||||||
public Envelope FakeEnvelope => this.CreateEnvelope(Host.User.Id);
|
protected Envelope FakeEnvelope => this.CreateEnvelope(Host.User.Id);
|
||||||
|
|
||||||
|
protected IRepository<T> GetRepository<T>() where T : class => Host.GetRepository<T>();
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public virtual async Task Setup()
|
public virtual async Task Setup()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user