public void TestBankAccountWithdrawInRange() { var bankAccount = new BankAcount(3000); bankAccount.Withdraw(300); Assert.That(bankAccount.Amount, Is.InRange(2700 - 2700 * 0.5m, 2700)); }
public void TestBankAccountWithdrawIsNotNaN() { var bankAccount = new BankAcount(3000); bankAccount.Withdraw(300); Assert.That(bankAccount.Amount, Is.Not.NaN); }
public void TestBankAccountWithdrawLessThan() { var bankAccount = new BankAcount(3000); bankAccount.Withdraw(300); Assert.That(bankAccount.Amount, Is.LessThan(2700)); }
public void TestBankAccountWithdraw() { decimal initialAmount = 3000; var bankAccount = new BankAcount(initialAmount); Assert.Multiple(() => { decimal withdrawAmount = 300; decimal expectedLefOverAmount = initialAmount - withdrawAmount - withdrawAmount * 0.05m; bankAccount.Withdraw(withdrawAmount); Assert.That(bankAccount.Amount, Is.EqualTo(expectedLefOverAmount)); withdrawAmount = 1500; expectedLefOverAmount = bankAccount.Amount - withdrawAmount - withdrawAmount * 0.02m; bankAccount.Withdraw(withdrawAmount); Assert.That(bankAccount.Amount, Is.EqualTo(expectedLefOverAmount)); }); }
public void TestBankAccountIsInstanceOf() { var bankAccount = new BankAcount(3000); Assert.That(bankAccount, Is.InstanceOf <BankAcount>()); }
public void TestBankAccountInstantiation() { var bankAccount = new BankAcount(3000); Assert.That(bankAccount, Is.Not.Null); }
public void TestBankAccountInstantiationException() { Assert.That(() => { BankAcount bankAccount = new BankAcount(-100); }, Throws.TypeOf <ArgumentException>()); }