public void TransferFunds(Account destination, decimal amount) { destination.Deposit(amount); if(amount > 1000) throw new Exception("aaa"); this.Withdraw(amount); }
public void Deposit_PositiveValue_ShouldAddToBalance() { // Arrange account = new Account(); // Act account.Deposit(100); // Assert Assert.AreEqual(100, account.Balance); }
public void TransferFunds_WhenHaveFunds_ShouldTransfer() { // AAA // Arrange var src = new Account(); src.Deposit(200); var dst = new Account(); dst.Deposit(100); // Act src.TransferFunds(dst, 100); // Assert Assert.AreEqual(200, dst.Balance); Assert.AreEqual(100, src.Balance); }
public void TransferFunds_WhenNoFunds_ShouldThrowsException() { Account source = new Account(); source.Deposit(150m); Account destination = new Account(); destination.Deposit(200m); //source.TransferFunds(destination, 200); Assert.Throws<Exception>(() => source.TransferFunds(destination, 200)); Assert.AreEqual(150m, source.Balance); Assert.AreEqual(400m, destination.Balance); }
public void TransferFunds_WhenTransfer1000_ShouldThrowsException() { Account source = new Account(); source.Deposit(2000); Account destination = new Account(); Assert.Throws<Exception>(() => source.TransferFunds(destination, 1500)); }