public void TestAccountBalanceAllDeposits() { LeafAccount account = new LeafAccount("AC1"); account.AddEntry(new Entry(EntryType.Deposit, 15.05M)); account.AddEntry(new Entry(EntryType.Deposit, 67.32M)); account.AddEntry(new Entry(EntryType.Deposit, 11.10M)); account.AddEntry(new Entry(EntryType.Deposit, 112.35M)); Assert.AreEqual(account.Entries.Count(), 4); Assert.AreEqual(account.Balance, 205.82M); }
public void TestNetWorth() { Person person = new Person(); CompositeAccount account1 = new CompositeAccount("AC1"); LeafAccount account2 = new LeafAccount("AC2", 200M); LeafAccount account3 = new LeafAccount("AC3"); LeafAccount account4 = new LeafAccount("AC4"); account1.AddAccount(account2); account1.AddAccount(account3); account1.AddAccount(account4); person.AddAccount(account1); account2.AddEntry(new Entry(EntryType.Deposit, 20.75M)); account2.AddEntry(new Entry(EntryType.Withdrawal, 11.13M)); account3.AddEntry(new Entry(EntryType.Deposit, 1220.67M)); account3.AddEntry(new Entry(EntryType.Withdrawal, 654.44M)); account4.AddEntry(new Entry(EntryType.Withdrawal, 110.98M)); Assert.AreEqual(new Money(664.87M), person.NetWorth); }