Added a-frame-architecture usiung wolverine sample.
This commit is contained in:
+35
@@ -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.Spend))!;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user