Exemple #1
0
        public void BasicAccountDepositRuleTest(string accountNumber, string name, decimal balance, AccountType accountType, decimal amount, bool expectedResult)
        {
            IDeposit deposit = new NoLimitDepositRule();
            Account  account = new Account();

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

            AccountDepositResponse response = deposit.Deposit(account, amount);

            Assert.AreEqual(expectedResult, response.Success);
        }
Exemple #2
0
        public void BasicAccountDepositRuleTest(string accountNumber, string name, decimal balance, AccountType accountType, decimal amount, bool expectedResult)
        {
            IDeposit ruke = new NoLimitDepositRule();
            Account  juke = new Account();

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

            AccountDepositResponse adr = ruke.Deposit(juke, amount);

            Assert.AreEqual(expectedResult, adr.Success);
        }
        [TestCase("55555", "Premium Account", 100, AccountType.Premium, 250, true)]   //success
        public void PremiumAccountDepositRuleTest(string accountNumber, string name, decimal balance, AccountType type, decimal amount, bool expectedResult)
        {
            IDeposit deposit = new NoLimitDepositRule();
            Account  account = new Account()
            {
                AccountNumber = accountNumber,
                Name          = name,
                Balance       = balance,
                Type          = type,
            };
            AccountDepositResponse response = deposit.Deposit(account, amount);

            Assert.AreEqual(expectedResult, response.Success);
        }
        public void PremiumAccountDepositRuleTest(string accountNumber, string name, decimal balance,
                                                  AccountType accountType, decimal amount, bool expectedResult)
        {
            IDeposit deposit = new NoLimitDepositRule();
            Account  account = new Account();

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

            AccountDepositResponse accountDeposit = deposit.Deposit(account, amount);

            Assert.That(accountDeposit.Success, Is.EqualTo(expectedResult));
        }
        public void BasicAccountDepositTest(string accountNumber, string name, decimal balance, AccountType accountType, decimal amount, bool expectedResult)
        {
            IDeposit basicDeposit = new NoLimitDepositRule();

            Account account = new Account()
            {
                AccountNumber = accountNumber, Name = name, Balance = balance, Type = accountType
            };

            AccountDepositResponse result = basicDeposit.Deposit(account, amount);

            var actual = result.Success;

            Assert.AreEqual(expectedResult, actual);
        }
Exemple #6
0
        public void FreeAccountDepositRuleTest(string acctNum, string name, decimal balance, AccountType accountType, decimal amount, bool expectedResult)
        {
            IDeposit RuleTest = new NoLimitDepositRule();
            Account  acct     = new Account()
            {
                AccountNumber = acctNum,
                Name          = name,
                Balance       = balance,
                Type          = accountType
            };

            AccountDepositResponse response = RuleTest.Deposit(acct, amount);
            bool actual = response.Success;

            Assert.AreEqual(expectedResult, actual);
        }
        public void BasicAccountDepositRuleTest(string accountNumber, string name, decimal balance, AccountType accountType, decimal amount, decimal expectedBalance, bool expectedResult)
        {
            IDeposit depositResponse = new NoLimitDepositRule();

            Account accountVariable = new Account()
            {
                AccountNumber = accountNumber,
                Name          = name,
                Balance       = balance,
                Type          = accountType
            };
            AccountDepositResponse accountDepositResponse = depositResponse.Deposit(accountVariable, amount);

            Assert.AreEqual(expectedResult, accountDepositResponse.Success);
            Assert.AreEqual(expectedBalance, accountDepositResponse.Account.Balance);
        }
Exemple #8
0
        public static void CorrectAmountDepositedWithdrawPremium(string accountNumber)
        {
            //after this files are in arraylist
            FileAccountRepository TestFileRepo =
                new FileAccountRepository("C:/Users/Jeremy/source/repos/SGBank052020/SGBank.Data/AccountsForTestingDeposit.txt");
            Account  a = TestFileRepo.LoadAccount(accountNumber);
            decimal  beginningBalance = a.Balance; //100
            IDeposit deposit          = new NoLimitDepositRule();

            deposit.Deposit(a, 10); //stores new balance in account
            TestFileRepo.SaveAccount(a);
            Assert.AreEqual(a.Balance, 110);

            IWithdraw withdraw = new PremiumAccountWithdrawRule();

            withdraw.Withdraw(a, -10);
            TestFileRepo.SaveAccount(a);
            Assert.AreEqual(a.Balance, 100);
        }
Exemple #9
0
        public void BasicAccountDepositRuleTest(string accountNumber, string name, decimal balance, AccountType accountType, decimal amount, bool expectedResult)
        {
            IDeposit deposit;

            NoLimitDepositRule noLimitRule = new NoLimitDepositRule();

            deposit = noLimitRule;

            Account account = new Account
            {
                Name          = name,
                Balance       = balance,
                AccountNumber = accountNumber,
                Type          = accountType
            };

            AccountDepositResponse actualResult = deposit.Deposit(account, amount);

            Assert.AreEqual(expectedResult, actualResult.Success);
        }
        [TestCase("44444", "Premium Account", 100, AccountType.Premium, 250, true)]   //success
        //what will this test do
        public void PremiumAccountDepositRuleTest(string accountNumber, string name, decimal balance,
                                                  AccountType accountType, decimal amount, bool expectedResult)
        {
            //IDeposit contains: accountdeposit response --
            //AccountDepositResponse contains: Account object, Amount, Old Balance
            //Account object contains: Name, Account Number, Balance, and Type
            //Response Oject(General) Success: bool, Message: string
            //NoLimitDepositRule contains: returns response object, sets success annd Message based on
            ////condition/rule

            IDeposit deposit = new NoLimitDepositRule();//Ideposit - contains accountdeposit resp[onse
            Account  account = new Account();

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

            //takes in locat account var and amount param
            AccountDepositResponse response = deposit.Deposit(account, amount);

            Assert.AreEqual(expectedResult, response.Success);
        }
Exemple #11
0
        public void PremiumAccountDepositTest(string accountNumber, string name, decimal balance,
                                              AccountType accountType, decimal amount, decimal newBalance, bool expectedResult)
        {
            IDeposit deposit = new NoLimitDepositRule();
            Account  account = new Account();

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

            AccountDepositResponse response = deposit.Deposit(account, amount);

            Assert.AreEqual(expectedResult, response.Success);

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