Genral clean up and moving of code.

This commit is contained in:
2026-07-30 17:01:33 +02:00
parent b37ca9222d
commit 2abe392890
19 changed files with 141 additions and 18 deletions
@@ -0,0 +1,35 @@
using FinancialApi.Application.Commands;
using FinancialApi.Application.Interfaces;
using FinancialApi.Domain.Entities;
using FinancialApi.Domain.Events;
using FluentAssertions;
using Wolverine;
using Wolverine.Tracking;
namespace FinancialApi.Infrastructure.Tests;
internal class FakeAccountQuery : IAccountQuery
{
public Task<Account?> FindByIdAsync(int id) => Task.FromResult(new Account(id, 100.00m, AccountType.Debit))!;
}
public class ApplyFeeIntegrationTests(WolverineTestFixture fixture) : IClassFixture<WolverineTestFixture>
{
[Fact]
public async Task GivenValidCommand_WhenApplyingFee_ShouldPublishFeeAppliedEvent()
{
// Arrange
var command = new ApplyFeeCommand(1, 100);
// Act
var session = await fixture.Host.InvokeMessageAndWaitAsync(command);
// Assert
session.Sent.AllMessages()
.ShouldHaveMessageOfType<FeeAppliedEvent>();
session.Sent.MessagesOf<FeeAppliedEvent>()
.Count()
.Should()
.Be(1);
}
}