Added first unit test.

This commit is contained in:
2026-07-17 13:17:41 +02:00
parent d77e575c00
commit 09a89a34c4
4 changed files with 75 additions and 1 deletions
@@ -0,0 +1,30 @@
using FinancialApi.Domain;
using FluentAssertions;
using FluentAssertions.Execution;
namespace FinancialApi.Application.UnitTests;
public class ApplyFeeHandlerTests
{
[Fact]
public void GivenValidAccounts_BasicFee_ShouldValidateEverything()
{
// Arrange
var command = new ApplyFeeCommand(1, 100);
var account = new Account(1, 100, "Debit");
var destAccount = new Account(99999, 100, "Credit");
var pair = new FeePair(account, destAccount, TimeProvider.System.GetUtcNow());
// Act
var intents = ApplyFeeHandler.Handle(command, pair);
// Assert
using var _ = new AssertionScope();
intents.CustomerWrite.Entity.Balance.Should().Be(0);
intents.RevenueWrite.Entity.Balance.Should().Be(200);
intents.RevenueWrite.Entity.Balance.Should().Be(200);
intents.JournalWrite.Entity.Lines.Count.Should().Be(2);
intents.Event.AccountId.Should().Be(account.Id);
intents.Event.Amount.Should().Be(100);
}
}