Exemplo n.º 1
0
        public static void Withdraw_ShouldReturnTrue_When_FundsAreSufficient(double deposit, double withdraw)
        {
            var account = new RetirementAccount("123");

            account.Deposit(deposit);

            Assert.True(account.WithDraw(withdraw));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Adds a new BankAccount and returns it
        /// </summary>
        public T AddAccount <T>(double credit = 0) where T : BankAccount
        {
            BankAccount account = null;

            if (typeof(T) == typeof(CheckingAccount))
            {
                account = new CheckingAccount(credit);
            }
            else if (typeof(T) == typeof(RetirementAccount))
            {
                account = new RetirementAccount();
            }
            else if (typeof(T) == typeof(SavingsAccount))
            {
                account = new SavingsAccount();
            }
            else
            {
                throw new NotImplementedException();
            }

            BankAccounts.Add(account);
            return(account as T);
        }
Exemplo n.º 3
0
        public static void Withdraw_ShouldReturnFalse_When_FundsAreNotSufficient()
        {
            var account = new RetirementAccount("123");

            Assert.False(account.WithDraw(1));
        }
        // GET: Accounts
        public ActionResult Accounts()
        {
            var ira = RetirementAccount.GetMutualFund();

            return(View(ira));
        }
        // GET: Stocks
        public ActionResult Detail(string id)
        {
            var stocks = RetirementAccount.GetMutualFund();

            return(View(stocks));
        }