public static Portfolio createWith(SummarizingAccount anAccount) { Portfolio portfolio = new Portfolio(); portfolio.add(anAccount); return(portfolio); }
public List <AccountTransaction> transactionsOf(SummarizingAccount account) { if (!manages(account)) { throw new Exception(ACCOUNT_NOT_MANAGED); } return(account.transactions()); }
public void add(SummarizingAccount account) { if (manages(account)) { throw new Exception(ACCOUNT_ALREADY_MANAGED); } this.summarizingAccounts.Add(account); }
public static Portfolio createWith(SummarizingAccount anAccount1, SummarizingAccount anAccount2) { List <SummarizingAccount> accounts = new List <SummarizingAccount>() { anAccount1, anAccount2 }; return(Portfolio.createWith(accounts)); }
public bool manages(SummarizingAccount account) { if (account == this) { return(true); } bool res = false; m_accounts.ForEach(acount => res = acount.manages(account) || res); return(res); }
public bool manages(SummarizingAccount account) { throw new Exception(); }
public List <AccountTransaction> transactionsOf(SummarizingAccount account) { throw new Exception(); }
public static Portfolio createWith(SummarizingAccount anAccount1, SummarizingAccount anAccount2) { throw new Exception(); }
public bool manages(SummarizingAccount account) { return(this == account || summarizingAccounts.Any(summarizingAccount => summarizingAccount.manages(account))); }
public bool manages(SummarizingAccount account) { return(this == account); }