Example #1
0
 public void TestDeposit()
 {
     BankAccount account = new BankAccount();
     account.Deposit(125.0);
     account.Deposit(25.0);
     Assert.AreEqual(150.0, account.Balance);//change something in here.
 }
Example #2
0
 public void PayInterest_AddsAppropriateAmmountToBalance()
 {
     var source = new BankAccount();
     source.Deposit(25.0);
     source.PayInterest(10.0);
     Assert.That(source.Balance, Is.EqualTo(27.5));
 }
Example #3
0
 public void ExcessiveWithdrawal_ThrowsOneApplicationException()
 {
     var account = new BankAccount();
     account.Deposit(25.0);
     Assert.Throws<ApplicationException>(() => account.Withdraw(30.0));
     Assert.AreEqual(0, 0);
 }
Example #4
0
 public void TestWithdraw()
 {
     BankAccount account = new BankAccount();
     account.Deposit(125.0);
     account.Withdraw(25.0);
     account.Withdraw(50.0);//make a change
     Assert.AreEqual(50.0, account.Balance);
 }
Example #5
0
        public void Transfer_WithInadequateBalance_ThrowsArgumentException_MakesNoChanges()
        {
            var source = new BankAccount();
            source.Deposit(25.0);
            var destination = new BankAccount();
            destination.Deposit(100.0);

            Assert.Throws<ApplicationException>(() => source.TransferFunds(destination, 50.0));
            Assert.That(source.Balance, Is.EqualTo(25.0));
            Assert.That(destination.Balance, Is.EqualTo(100.0));
        }
Example #6
0
        public void TransferFunds()
        {
            BankAccount source = new BankAccount();
            source.Deposit(200.00);
            BankAccount destination = new BankAccount();
            destination.Deposit(150.00);

            source.TransferFunds(destination, 100.00);
            Assert.AreEqual(250.00, destination.Balance);
            Assert.AreEqual(100.00, source.Balance);
        }
Example #7
0
 public void TransferFunds(BankAccount destination, double amount)
 {
     Withdraw(amount); // Do this first so destination balance is not changed if it fails.
     destination.Deposit(amount);
 }