From c67bac3e169df3184ab761eca9899ac08048089f Mon Sep 17 00:00:00 2001 From: TekH Date: Tue, 2 Sep 2025 18:48:18 +0200 Subject: [PATCH] =?UTF-8?q?test(history):=20Aktualisieren=20Sie=20HistoryT?= =?UTF-8?q?ests,=20um=20die=20Erstellung=20von=20Umschl=C3=A4gen=20auf=20R?= =?UTF-8?q?epository-Basis=20zu=20verwenden.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EnvelopeGenerator.Tests.Application/HistoryTests.cs | 7 +++++-- EnvelopeGenerator.Tests.Application/TestBase.cs | 11 +++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/EnvelopeGenerator.Tests.Application/HistoryTests.cs b/EnvelopeGenerator.Tests.Application/HistoryTests.cs index 3d022b78..b1053dff 100644 --- a/EnvelopeGenerator.Tests.Application/HistoryTests.cs +++ b/EnvelopeGenerator.Tests.Application/HistoryTests.cs @@ -2,6 +2,7 @@ using EnvelopeGenerator.Application.Histories.Commands; using EnvelopeGenerator.Application.Histories.Queries; using EnvelopeGenerator.Domain.Constants; +using EnvelopeGenerator.Domain.Entities; namespace EnvelopeGenerator.Tests.Application; @@ -24,9 +25,11 @@ public class HistoryTests : TestBase public async Task CreateHistory_And_ReadHistory_Should_Work() { /// Arrange + CancellationToken cancel = default; + // Create envelope - var createEnvelopeCmd = FakeCreateEnvelopeCommand; - var envelope = await Mediator.Send(createEnvelopeCmd).ThrowIfNull(Exceptions.NotFound); + var envelope = FakeEnvelope; + envelope = await GetRepository().CreateAsync(envelope, cancel); // Create receiver var createReceiverCmd = this.CreateReceiverCommand(); diff --git a/EnvelopeGenerator.Tests.Application/TestBase.cs b/EnvelopeGenerator.Tests.Application/TestBase.cs index 1a2ace1f..9c0bafde 100644 --- a/EnvelopeGenerator.Tests.Application/TestBase.cs +++ b/EnvelopeGenerator.Tests.Application/TestBase.cs @@ -1,4 +1,5 @@ using Bogus; +using DigitalData.Core.Abstraction.Application.Repository; using DigitalData.UserManager.Domain.Entities; using EnvelopeGenerator.Application.Envelopes.Commands; using EnvelopeGenerator.Domain.Entities; @@ -10,13 +11,15 @@ public class TestBase : Faker { 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 GetRepository() where T : class => Host.GetRepository(); [SetUp] public virtual async Task Setup()