Beispiel #1
0
        static void Main(string[] args)
        {
            BankAccount savingAccount  = new SavingBankAccount("Sarvesh", "S12345");
            BankAccount currentAccount = new CurrentBankAccount("Mark", "C12345");

            BankAccount savingAccountTest  = new SavingBankAccount("Vanya", "S12347");
            BankAccount currentAccounttest = new CurrentBankAccount("Vasya", "C12345");


            savingAccount.Deposit(40000);
            savingAccount.Withdraw(1000);
            savingAccount.Withdraw(1000);
            savingAccount.Withdraw(1000);

            // Generate Report
            savingAccount.GenerateAccountReport();

            Console.WriteLine();
            currentAccount.Deposit(190000);
            currentAccount.Withdraw(1000);
            currentAccount.GenerateAccountReport();

            //тестируем исключения
            savingAccountTest.Deposit(-100);
            savingAccountTest.Deposit(1000);
            savingAccountTest.Withdraw(-1000);
            savingAccountTest.Withdraw(2000);

            savingAccountTest.GenerateAccountReport();

            Console.ReadLine();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            ILogger logger = new ConsoleLogger();

            try
            {
                BankAccount savingAccount  = new SavingBankAccount("Sarvesh", "S12345", logger);
                BankAccount currentAccount = new CurrentBankAccount("Mark", "C12345", logger);

                savingAccount.Deposit(400000);
                savingAccount.Withdraw(100000000);
                //savingAccount.Withdraw(1000);
                //savingAccount.Withdraw(1000);

                // Generate Report
                savingAccount.GenerateAccountReport();

                currentAccount.Deposit(190000);
                currentAccount.Withdraw(1000);
                currentAccount.GenerateAccountReport();
            }
            catch (ArgumentNullException e)
            {
                logger.Write(e.Message);
            }
            catch (User_Defined_Exceptions.MinimumBalanceLimitException e)
            {
                logger.Write(e.Message);
            }
            catch (User_Defined_Exceptions.ExceedDepositAmountException e)
            {
                logger.Write(e.Message);
            }
            catch (User_Defined_Exceptions.ExceedThriceWithdrawAmountException e)
            {
                logger.Write(e.Message);
            }
            catch (User_Defined_Exceptions.GenerateReportException e)
            {
                logger.Write(e.Message);
            }

            Console.ReadLine();
        }