public void TestInitialise() { var accountTypeRepo = new InMemoryAccountTypeRepository(); var subject = new Mapper_LedgerEntryDto_LedgerEntry(new LedgerBucketFactory(new BucketBucketRepoAlwaysFind(), accountTypeRepo), new LedgerTransactionFactory(), accountTypeRepo); Result = subject.ToDto(TestData); }
private static void UpdateLineBalances(LedgerEntryLineDto currentLine, LedgerEntryLineDto previousLine, decimal bankBalance) { currentLine.BankBalance = bankBalance; currentLine.BankBalances.Add(new BankBalanceDto { Account = StatementModelTestData.ChequeAccount.Name, Balance = bankBalance }); if (previousLine == null) { return; } foreach (LedgerEntryDto entry in currentLine.Entries) { LedgerEntryDto previousEntry = previousLine.Entries.Single(e => e.BucketCode == entry.BucketCode); entry.Balance = previousEntry.Balance + entry.Transactions.Sum(t => t.Amount); if (entry.Balance < 0) { entry.Balance = 0; } } }