Ejemplo n.º 1
0
        public static void TestMyAccount()
        {
            IAccount account = new MyBankAccount();

            account.PayInFunds(50);
            Console.WriteLine("Balance: " + account.GetBalance());
        }
Ejemplo n.º 2
0
        public static void TestAccountSort()
        {
            // Create 20 accounts with random balances
            List <IAccount> accounts = new List <IAccount>();
            Random          rand     = new Random(1);

            for (int i = 0; i < 20; i++)
            {
                IAccount account = new MyBankAccount(rand.Next(0, 10000));
                accounts.Add(account);
            }

            // Sort the accounts
            accounts.Sort();

            // Display the sorted accounts
            foreach (IAccount account in accounts)
            {
                Console.WriteLine(account.GetBalance());
            }
        }