예제 #1
0
        public static Portfolio createWith(SummarizingAccount anAccount)
        {
            Portfolio portfolio = new Portfolio();

            portfolio.add(anAccount);

            return(portfolio);
        }
예제 #2
0
 public List <AccountTransaction> transactionsOf(SummarizingAccount account)
 {
     if (!manages(account))
     {
         throw new Exception(ACCOUNT_NOT_MANAGED);
     }
     return(account.transactions());
 }
예제 #3
0
        public void add(SummarizingAccount account)
        {
            if (manages(account))
            {
                throw new Exception(ACCOUNT_ALREADY_MANAGED);
            }

            this.summarizingAccounts.Add(account);
        }
예제 #4
0
        public static Portfolio createWith(SummarizingAccount anAccount1, SummarizingAccount anAccount2)
        {
            List <SummarizingAccount> accounts = new List <SummarizingAccount>()
            {
                anAccount1, anAccount2
            };

            return(Portfolio.createWith(accounts));
        }
예제 #5
0
        public bool manages(SummarizingAccount account)
        {
            if (account == this)
            {
                return(true);
            }

            bool res = false;

            m_accounts.ForEach(acount => res = acount.manages(account) || res);
            return(res);
        }
예제 #6
0
 public bool manages(SummarizingAccount account)
 {
     throw new Exception();
 }
예제 #7
0
 public List <AccountTransaction> transactionsOf(SummarizingAccount account)
 {
     throw new Exception();
 }
예제 #8
0
 public static Portfolio createWith(SummarizingAccount anAccount1, SummarizingAccount anAccount2)
 {
     throw new Exception();
 }
예제 #9
0
 public bool manages(SummarizingAccount account)
 {
     return(this == account || summarizingAccounts.Any(summarizingAccount => summarizingAccount.manages(account)));
 }
예제 #10
0
 public bool manages(SummarizingAccount account)
 {
     return(this == account);
 }