public void TestWithdraw()
        {
            BankAccount bankAccount = new BankAccount("41513531", "name", "surname", CardType.Gold);

            bankAccount.AddFunds(5);
            Assert.Throws <InsufficientFundsException>(() => bankAccount.WithdrawFunds(10));
        }
Example #2
0
 public void TransferFunds(BankAccount sender, BankAccount recipient, decimal sum)
 {
     if (sender.Sum >= sum)
     {
         sender.WithdrawFunds(sum);
         recipient.AddFunds(sum);
     }
 }
Example #3
0
        public void TransferFunds(BankAccount sender, BankAccount recipient, decimal sum)
        {
            if (sender.Sum >= sum)
            {
                sender.WithdrawFunds(sum);
                SendMessage(recipient, $"Можете снять {sum} рублей в ближайшем отделении");
                Thread.Sleep(1000 * 10);

                recipient.AddFunds(sum);
            }
        }
Example #4
0
        static void Main(string[] args)
        {
            SolutonBankAccount.Classes.BankAccount account = new BankAccount("0", 100, "Ilya", "Dzeraziak", 0, AccountRate.Base);

            var service = new BankAccountService();

            account.AddFunds(15);
            account.CreateAccount(new BankAccount("1", 150, "Some", "As", 15, AccountRate.Platinum));
            account.Accounts[0].AddFunds(20);
            account.CloseAccount(account.Accounts[0]);

            service.SaveToBinary(account);
        }
Example #5
0
 public static void Transaction(BankAccount from, BankAccount to, decimal sum)
 {
     from.WithdrawFunds(sum);
     try
     {
         to.AddFunds(sum);
     }
     catch
     {
         from.AddFunds(sum);
         throw new Exception("Операция перевода средств между счетами не может быть выполнена");
     }
 }
Example #6
0
        public void Transaction(BankAccount from, BankAccount to, decimal sum)
        {
            from.WithdrawFunds(sum);
            if (sum > 0 && to.GetStatus())
            {
                to.AddFunds(sum);
            }

            else
            {
                from.AddFunds(sum);
                throw new Exception("Операция перевода средств между счетами не может быть выполнена");
            }
        }