public static Portfolio Open(PortfolioId id, AccountType accountType, Money initialDeposit) { if (initialDeposit < MinimumPortfolioBalance) { throw new InvalidOperationException(String.Format("The intial deposit of {0} is lower than the require a minimum of {1}", initialDeposit, MinimumPortfolioBalance)); } var portfolio = new Portfolio(id); portfolio.OpenAccount(accountType); portfolio.CreditAccount(accountType, initialDeposit); return(portfolio); }
protected Portfolio(PortfolioId id) : base(id) { accounts = new HashSet <Account>(); isOpen = true; }