Пример #1
0
        public void Debit()
        {
            int        debitAmount       = 100;
            int        bankAccountAmount = 100;
            BaseEntity notifications     = new BaseEntity();
            int        result            = BankAccountService.Debit(debitAmount, bankAccountAmount, notifications);

            Assert.AreEqual(200, result);
        }
Пример #2
0
        public void DebitLessThanZeroAmount()
        {
            int        debitAmount       = -50;
            int        bankAccountAmount = 100;
            BaseEntity notifications     = new BaseEntity();
            int        result            = BankAccountService.Debit(debitAmount, bankAccountAmount, notifications);

            Assert.AreEqual(0, result);
            Assert.AreEqual("Yatırmak istediğiniz tutar 0'dan buyuk olmalıdır", notifications.Errors[0]);
            Assert.AreEqual(notifications.IsSuccess, false);
        }
Пример #3
0
        private void btnDebit_Click(object sender, EventArgs e)
        {
            int result = 0;

            if (int.TryParse(txtDebit.Text, out result))
            {
                BaseEntity notifications = new BaseEntity();
                int        totalAmount   = BankAccountService.Debit(UserId, BankAccountNumber, result, Amount, notifications);
                if (notifications.IsSuccess)
                {
                    Amount         = totalAmount;
                    lblAmount.Text = Amount + " TL";
                }
                else
                {
                    lblError.Text = notifications.Errors[0];
                }
            }
            else
            {
                lblError.Text = "Rakamsall bir değer girin!";
            }
            txtDebit.Text = string.Empty;
        }