public void TestProcessMonthlyInterest()
        {
            TestSnapShotDailyBalance();
            InterestController interestController = new InterestController();
            double interestRate = interestController.GetInterestRate(_unitUnderTest);
            _unitUnderTest.ProcessMonthlyInterest(interestRate);
            Assert.AreEqual(105 + ((150.0 + 105.0) / 2 * interestRate) /*108.1875*/, _unitUnderTest.GetBalance());

            Account oldAccount = new Account(150, new DateTime(DateTime.Now.AddYears(-7).Ticks));
            oldAccount.SnapShotDailyBalance();
            oldAccount.Withdraw(45);
            oldAccount.SnapShotDailyBalance();
            interestRate = interestController.GetInterestRate(oldAccount);
            oldAccount.ProcessMonthlyInterest(interestRate);
            Assert.AreEqual(105 + ((150.0 + 105.0) / 2 * interestRate), oldAccount.GetBalance());

            Account newAccountWHighBalance = new Account(70000);
            newAccountWHighBalance.SnapShotDailyBalance();
            newAccountWHighBalance.Deposit(60000);
            newAccountWHighBalance.SnapShotDailyBalance();
            interestRate = interestController.GetInterestRate(newAccountWHighBalance);
            newAccountWHighBalance.ProcessMonthlyInterest(interestRate);
            Assert.AreEqual(130000 + ((70000.0 + 130000.0) / 2 * interestRate) /*132500*/, newAccountWHighBalance.GetBalance());

            Account oldAccountWHighBalance =
                new Account(70000, new DateTime(DateTime.Now.AddYears(-7).Ticks));
            oldAccountWHighBalance.SnapShotDailyBalance();
            oldAccountWHighBalance.Deposit(60000);
            oldAccountWHighBalance.SnapShotDailyBalance();
            interestRate = interestController.GetInterestRate(oldAccountWHighBalance);
            oldAccountWHighBalance.ProcessMonthlyInterest(interestRate);
            Assert.AreEqual(130000 + ((70000.0 + 130000.0) / 2 * interestRate), oldAccountWHighBalance.GetBalance());
        }
 public void Print(Account account)
 {
     Console.WriteLine("Dane konta: {0}", account.AccountNumber);
     Console.WriteLine("Typ: {0}", account.TypeName());
     Console.WriteLine("Saldo: {0}", account.GetBalance());
     Console.WriteLine("Imię i nazwisko właściciela: {0}", account.GetFullName());
     Console.WriteLine("Pesel: {0}", account.Pesel);
     Console.WriteLine("{0}" + breakLine + "{0}", Environment.NewLine);
 }
Exemple #3
0
 public void Print(Account account)
 {
     Console.WriteLine("Numer konta: {0}", account.AccountNumber);
     Console.WriteLine("Typ konta: {0}", account.TypeName());
     Console.WriteLine("Saldo: {0}zł.", account.GetBalance());
     Console.WriteLine("Imię i nazwisko właściciela: {0}", account.GetFullName2());
     Console.WriteLine("PESEL: {0}", account.Pesel);
     Console.WriteLine();
 }
Exemple #4
0
 public void Print(Account account)
 {
     Console.WriteLine($"Dane konta: {account.AccountNumber}");
     Console.WriteLine($"Typ konta: {account.TypeName()}");
     Console.WriteLine(account.GetBalance());
     Console.WriteLine($"Imię i nazwisko właściciela: {account.GetFullName()}");
     Console.WriteLine($"PESEL właściciela: {account.Pesel}");
     Console.WriteLine();
 }
Exemple #5
0
        static void Main(string[] args)
        {
            //"get balance", "Deposit", "Withdraw, "exit";
            Console.WriteLine("Enter your name: ");
            string name = Console.ReadLine();

            Console.WriteLine("Enter your surname: ");
            string surname = Console.ReadLine();

            Console.WriteLine("Enter your currency: ");
            string currency = Console.ReadLine();


            Account account = new Account(name, surname, currency);

            Console.WriteLine(name + " " + surname + " ," + currency);

            while (true)
            {
                Console.WriteLine("Enter command: ");
                string command = Console.ReadLine().ToLower();

                switch (command)
                {
                case "get balance":
                    account.GetBalance();

                    break;

                case "deposit":
                    account.Deposit();
                    break;

                case "withdraw":
                    account.Withdraw();
                    break;



                default:
                    Console.WriteLine("Unknown command: ");
                    break;
                }
            }
        }