public void TestWithdraw() { BankAccount testAccount = new BankAccount("Hello", "Test", 100); testAccount.Deposit(1000); testAccount.Withdraw(100); testAccount.Withdraw(100); Assert.AreEqual(testAccount.Balance, 800); }
public void TestTransactionHistory() { BankAccount testAccount = new BankAccount("Hello", "Test", 1000); testAccount.Deposit(1000); testAccount.Withdraw(100); testAccount.Withdraw(100); testAccount.Deposit(1000); testAccount.Withdraw(100); testAccount.Withdraw(100); Assert.AreEqual(testAccount.Balance, 1600); CollectionAssert.AreEqual(testAccount.TransactionHistory, new List<double>() {1000, -100, -100, 1000, -100, -100}); }
static void Main() { try { BankAccount b = new BankAccount("Hello", "Test", 100.50); b.Deposit(200); b.Deposit(200); b.Withdraw(100); Console.WriteLine(b); Console.ReadKey(); } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); Console.ReadKey(); } }