Beispiel #1
0
        public void FreeAccountDepositRuleTest(string accountNumber, string name, decimal balance, AccountType accountType, decimal amount, bool expectedResult)
        {
            IDeposit deposit = new FreeAccountDepositRule();
            Account  account = new Account()
            {
                AccountNumber = accountNumber, accountType = accountType, Balance = amount
            };
            AccountDepositResponse response = deposit.Deposit(account, amount);

            Assert.AreEqual(expectedResult, response.Success);
        }
Beispiel #2
0
        public void FreeAccountDepositRuleTest(string accountNumber, string name, decimal balance, AccountType type, decimal amount, decimal newBalance, bool expected)
        {
            IDeposit deposit = new FreeAccountDepositRule();
            Account  account = new Account()
            {
                AccountNumber = accountNumber, Name = name, Balance = balance, Type = type
            };
            AccountDepositResponse response = deposit.Deposit(account, amount);

            Assert.AreEqual(expected, response.Success);
            Assert.AreEqual(newBalance, response.Account.Balance);
        }
Beispiel #3
0
        public void FreeAccountDepositRuleTest(string accountNumber, string name, decimal balance, AccountType accountType, decimal amount, bool expectedResult)
        {
            IDeposit depositVar = new FreeAccountDepositRule();
            Account  accountVar = new Account();

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

            AccountDepositResponse responseVar = depositVar.Deposit(accountVar, amount);

            Assert.AreEqual(expectedResult, responseVar.Success);
        }
Beispiel #4
0
        public void FreeAccountDepositRuleTest(string accountNumber, string name, decimal balance, AccountType accountType, decimal amount, bool expectedResult)
        {
            IDeposit ruke = new FreeAccountDepositRule();
            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);
        }
Beispiel #5
0
        public void FreeAccountDepositRuleTest(string accountNumber, string name, decimal balance, AccountType accountType, decimal amount, bool expectedResult)
        {
            var rule    = new FreeAccountDepositRule();
            var account = new Account
            {
                AccountNumber = accountNumber,
                Name          = name,
                Balance       = balance,
                Type          = accountType
            };
            var response = rule.Deposit(account, amount);

            Assert.AreEqual(expectedResult, response.Success);
        }
Beispiel #6
0
        public void FreeAccountDepositRuleTest(string accountNumber, string name, decimal balance, AccountType accountType, decimal amount, decimal newBalance, bool expectedResult)
        {
            IDeposit deposit = new FreeAccountDepositRule();
            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);
            Assert.AreEqual(account.Balance, newBalance);//testing expected balance accuracy
        }
        public void FreeAccountDepositRuleTest(string accountNumber, string name, decimal balance, AccountType accountType, decimal amount, bool expectedResult)
        {
            IDeposit depositTest = new FreeAccountDepositRule();

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

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

            var actual = result.Success;

            Assert.AreEqual(expectedResult, actual);
        }
Beispiel #8
0
        public void FreeAccountDepositRuleTest(string accountNumber, string name, decimal balance,
                                               AccountType accountType, decimal amount, bool expectedResult)
        {
            IDeposit deposit = new FreeAccountDepositRule();
            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));
        }
Beispiel #9
0
        public void FreeAccountDepositRuleTest(string accountNumber, string name, decimal balance,
                                               AccountType accountType, decimal amount, bool expectedResult)
        {
            IDeposit testDepositRule = new FreeAccountDepositRule();
            Account  testAccount     = new Account();

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

            AccountDepositResponse response = testDepositRule.Deposit(testAccount, amount);

            Assert.AreEqual(expectedResult, response.Success);
        }
Beispiel #10
0
        public void FreeAccountDepositRuleTest(string accountNumber, string name, decimal balance, AccountType accountType, decimal amount, decimal expectedBalance, bool expectedResult)
        {
            IDeposit depositResponse = new FreeAccountDepositRule();

            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);
        }
Beispiel #11
0
        public static void CorrectAmountDepositAndWithdrawFree(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 FreeAccountDepositRule();

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

            IWithdraw withdraw = new FreeAccountWithdrawRule();

            withdraw.Withdraw(a, -10);
            TestFileRepo.SaveAccount(a);
            Assert.AreEqual(a.Balance, 100);
        }
Beispiel #12
0
 public void FreeAccountDepositRuleTest(string accountNumber, string name, decimal balance, AccountType accountType, decimal amount, bool expected)
 {
     IDeposit deposit = new FreeAccountDepositRule();
     Account  account = new Account();
     {
         account.AccountNumber = accountNumber;
         account.Name          = name;
         account.Balance       = balance;
         account.Type          = accountType;
     }
     {
         AccountDepositResponse response = deposit.Deposit(account, amount);
         Assert.AreEqual(expected, response.Success);
         if (response.Success)
         {
             Assert.AreEqual(response.OldBalance += amount, response.Account.Balance);
         }
         else
         {
             Assert.AreEqual(balance, account.Balance);
         }
     }
 }