Re-layout source code to correct namespaces (handlers, commands, etc.)
This commit is contained in:
+11
-9
@@ -1,4 +1,7 @@
|
||||
using FinancialApi.Domain;
|
||||
using System.Security.Cryptography;
|
||||
using FinancialApi.Application.Commands;
|
||||
using FinancialApi.Application.Handlers;
|
||||
using FinancialApi.Domain;
|
||||
using FluentAssertions;
|
||||
using FluentAssertions.Execution;
|
||||
|
||||
@@ -12,19 +15,18 @@ public class ApplyFeeHandlerTests
|
||||
// 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());
|
||||
|
||||
var revenueAccount = new Account(99999, 0, "Credit");
|
||||
var pair = new FeePair(account, revenueAccount, 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.CustomerWrite.Entity.Balance.Should().Be(account.Balance - command.Amount);
|
||||
intents.RevenueWrite.Entity.Balance.Should().Be(revenueAccount.Balance + command.Amount);
|
||||
intents.JournalWrite.Entity.Lines.Count.Should().BeGreaterThanOrEqualTo(2);
|
||||
intents.Event.AccountId.Should().Be(account.Id);
|
||||
intents.Event.Amount.Should().Be(100);
|
||||
intents.Event.Amount.Should().Be(command.Amount);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user