BudgetAnalyser.Engine.UnitTest.TestData.LedgerBookBuilder.SetReconciliation C# (CSharp) Метод

SetReconciliation() приватный Метод

private SetReconciliation ( SpecificLedgerEntryTestDataBuilder>.IReadOnlyDictionary ledgers, string remarks ) : void
ledgers SpecificLedgerEntryTestDataBuilder>.IReadOnlyDictionary
remarks string
Результат void
        private void SetReconciliation(IReadOnlyDictionary<LedgerBucket, SpecificLedgerEntryTestDataBuilder> ledgers, string remarks)
        {
            var recon = new LedgerEntryLine(this.tempReconDate, this.tempBankBalances) { Remarks = remarks };
            LedgerEntryLine previousRecon = Reconciliations.OrderByDescending(r => r.Date).FirstOrDefault();
            var entries = new List<LedgerEntry>();

            foreach (LedgerBucket ledgerBucket in this.ledgerBuckets)
            {
                decimal openingBalance;
                if (previousRecon == null)
                {
                    openingBalance = this.openingBalances[ledgerBucket];
                }
                else
                {
                    LedgerEntry previousEntry = previousRecon.Entries.Single(e => e.LedgerBucket == ledgerBucket);
                    openingBalance = previousEntry.Balance;
                }
                var entry = new LedgerEntry
                {
                    LedgerBucket = ledgerBucket,
                    Balance = openingBalance
                };
                entry.SetTransactionsForTesting(ledgers[ledgerBucket].Transactions.ToList());
                entries.Add(entry);
            }

            recon.SetEntriesForTesting(entries);
            this.reconciliations.Add(recon);
        }