Exemplo n.º 1
0
 private void btnCheck_Click(object sender, EventArgs e)
 {
     if (rbtnPayment.Checked)
     {
         UserBanking banking = new UserBanking();
         banking.Payment(user, decimal.Parse(tbxInput.Text));
         tbxOutput.Text = "Payment was successfully made!";
     }
     else if (rbtnTransfer.Checked)
     {
         UserBanking banking = new UserBanking();
         if (banking.Transfer(user, decimal.Parse(tbxInput.Text)))
         {
             tbxOutput.Text = "Transfer was successfully done!";
         }
         else
         {
             tbxOutput.Text = "You don't have enough money on your account!";
         }
     }
     else if (rbtnCredit.Checked)
     {
         UserBanking banking = new UserBanking();
         if (banking.Credit(user, decimal.Parse(tbxInput.Text), dtpDate.Value))
         {
             Console.WriteLine(dtpDate.Value);
             tbxOutput.Text = "Credit has been successfully approved!";
         }
         else
         {
             Console.WriteLine(dtpDate.Value);
             tbxOutput.Text = "Credit request has been rejected!";
         }
     }
 }
Exemplo n.º 2
0
        public bool RevolvingCredit_FirstTestSuccess_SecondTestFailed(decimal amount, decimal monthlyAmount, decimal balance)
        {
            DateTime date = new DateTime(2025, 3, 23);
            User     user = new User("Pera", "Peric", monthlyAmount, balance, false);

            Form1.isChecked_rbtnRevolving = true;
            UserBanking bank = new UserBanking();

            return(bank.Credit(user, amount, date));
        }
Exemplo n.º 3
0
        public void CashCredit_Failed(decimal amount, decimal monthlyAmount, decimal balance)
        {
            DateTime date = new DateTime(2021, 3, 23);
            User     user = new User("Pera", "Peric", monthlyAmount, balance, false);

            Form1.isChecked_rbtnCash = true;
            UserBanking bank = new UserBanking();

            Assert.IsFalse(bank.Credit(user, amount, date));
        }
Exemplo n.º 4
0
        public void RevolvingCredit_Failed_UserAlreadyHasCredit(decimal amount, decimal monthlyAmount, decimal balance)
        {
            DateTime date = new DateTime(2025, 3, 23);
            User     user = new User("Pera", "Peric", monthlyAmount, balance, true);

            Form1.isChecked_rbtnRevolving = true;
            UserBanking bank = new UserBanking();

            Assert.IsFalse(bank.Credit(user, amount, date));
        }
Exemplo n.º 5
0
        public void CashCredit_DivideByZeroExceptionExpected()
        {
            DateTime date = new DateTime(2019, 3, 23);
            User     user = new User("Pera", "Peric", 5000, 5000, false);

            Form1.isChecked_rbtnCash = true;
            UserBanking bank = new UserBanking();

            Assert.Throws <DivideByZeroException>(() => bank.Credit(user, 7, date));
        }
Exemplo n.º 6
0
        public bool RevolvingSuccess(decimal monthlyAmount, decimal monthlyPayment, decimal amount)
        {
            User     user2 = new User("Petar", "Pericic", monthlyAmount, monthlyPayment, false);
            DateTime date2 = new DateTime(2021, 3, 20);

            OTS2019_BankSimulation.Form1.isChecked_rbtnRevolving = true;
            UserBanking ubanking = new UserBanking();

            return(ubanking.Credit(user2, amount, date2));
        }
Exemplo n.º 7
0
        public bool CashCreditSuccess(decimal amount)
        {
            User     user = new User("Pera", "Peric", 1000, 1000, false);
            DateTime date = new DateTime(2021, 3, 20);

            OTS2019_BankSimulation.Form1.isChecked_rbtnCash = true;
            UserBanking ubanking = new UserBanking();

            return(ubanking.Credit(user, amount, date));
        }