30 lines
1.0 KiB
C#
30 lines
1.0 KiB
C#
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);
|
|
}
|
|
} |