Ejemplo n.º 1
0
        public void FreeAccountWithdrawRuleTest(string accountNumber, string name, decimal balance, AccountType accountType, decimal amount, bool expectedResult)
        {
            IWithdraw withdraw = new FreeAccountWithdrawRules();
            Account   account  = new Account()
            {
                AccountNumber = accountNumber, Balance = balance, accountType = accountType
            };
            AccountWithdrawResponse response = withdraw.Withdraw(account, amount);

            Assert.AreEqual(expectedResult, response.Success);
        }
Ejemplo n.º 2
0
        public void FreeAccountWithdrawRuleTest(string accountNumber, string name, decimal balance,
                                                AccountType accountType, decimal amount, bool expectedResult)
        {
            IWithdraw withdraw = new FreeAccountWithdrawRules();
            Account   account  = new Account();

            account.Name          = name;
            account.Balance       = balance;
            account.Type          = accountType;
            account.AccountNumber = accountNumber;

            AccountWithdrawResponse response = withdraw.Withdraw(account, amount);

            Assert.AreEqual(expectedResult, response.Success);

            if (response.Success)
            {
                Assert.AreEqual(response.OldBalance + amount, response.Account.Balance);
            }
            else
            {
                Assert.AreEqual(balance, account.Balance);
            }
        }