Ejemplo n.º 1
0
        public IInterestAccount OpenInterestAccount(InterestAccountType type, decimal initialDeposit, InterestCounpoundType compoundType = InterestCounpoundType.Daily, double defaultRate = 0.0)
        {
            ValidationHelper.NotNull(type, "type");
            ValidationHelper.NegativeNumeric <decimal>(initialDeposit, "initialDeposit");
            ValidationHelper.NegativeNumeric <double>(defaultRate, "defaultRate");

            IInterestAccount _account = null;

            switch (type)
            {
            case (InterestAccountType.Checking):
                _account = new CheckingAccount(initialDeposit, compoundType, defaultRate);
                break;

            case (InterestAccountType.Savings):
                _account = new SavingsAccount(initialDeposit, compoundType, defaultRate);
                break;

            case (InterestAccountType.MaxiSavings):
                _account = new MaxiSavingsAccount(initialDeposit, compoundType, defaultRate);
                break;

            default:
                throw new Exception("Account type is not yet supported");
            }

            this.InterestAccounts.Add(_account);
            return(_account);
        }
Ejemplo n.º 2
0
        public void Maxi_savings_account()
        {
            Bank bank = new Bank();
            IAccount checkingAccount = new MaxiSavingsAccount();//Account(Account.MAXI_SAVINGS);

            bank.AddCustomer(new Customer("Bill").OpenAccount(checkingAccount));

            checkingAccount.Deposit(3000.0);

            Assert.AreEqual(3.0, bank.totalInterestPaid(), DOUBLE_DELTA);
        }