public void Should_SumSelectedAccountBalances() { Account account = new Account("SelectedLiquid", AccountType.Liquid); Account account2 = new Account("SelectedInvested", AccountType.Invested); AccountManager.Accounts.Add(account); AccountManager.Accounts.Add(account2); AccountManager.AddStatement(new Statement(1000, account), new DateTime(2000, 1, 1)); AccountManager.AddStatement(new Statement(2300, account2), new DateTime(2001, 1, 1)); ViewModel = new ManageAccountsViewModel(AccountManager); ViewModel.SelectNetWorth(); Assert.AreEqual(3300, ViewModel.NetBalance); }
public void Should_SubtractBalances_When_TheyAreDebtAccounts() { Account liquid = new Account("SelectedLiquid", AccountType.Liquid); Account invested = new Account("SelectedInvested", AccountType.Invested); Account debt = new Account("Debt", AccountType.Debt); AccountManager.Accounts.Add(liquid); AccountManager.Accounts.Add(invested); AccountManager.Accounts.Add(debt); AccountManager.AddStatement(new Statement(1000, liquid), new DateTime(2000, 1, 1)); AccountManager.AddStatement(new Statement(2300, invested), new DateTime(2001, 1, 1)); AccountManager.AddStatement(new Statement(1200, debt), new DateTime(2002, 1, 1)); ViewModel = new ManageAccountsViewModel(AccountManager); ViewModel.SelectNetWorth(); Assert.AreEqual(2100, ViewModel.NetBalance); }
public void Should_SelectedAllAccounts() { Account liquid = new Account("Liquid", AccountType.Liquid); Account invested = new Account("Invested", AccountType.Invested); Account debt = new Account("Debt", AccountType.Debt); Account property = new Account("Property", AccountType.Property); AccountManager.Accounts.Add(liquid); AccountManager.Accounts.Add(invested); AccountManager.Accounts.Add(debt); AccountManager.Accounts.Add(property); ViewModel = new ManageAccountsViewModel(AccountManager); Assert.AreEqual(0, ViewModel.Accounts.Count(a => a.IsSelected)); ViewModel.SelectNetWorth(); Assert.AreEqual(4, ViewModel.Accounts.Count(a => a.IsSelected)); }