Skip to content

Instantly share code, notes, and snippets.

@devjaime
Created March 18, 2019 02:02
Show Gist options
  • Select an option

  • Save devjaime/e01d8cba1e26766dcc659cc76e50f29f to your computer and use it in GitHub Desktop.

Select an option

Save devjaime/e01d8cba1e26766dcc659cc76e50f29f to your computer and use it in GitHub Desktop.
pruebas unitarias
[TestClass()]
public class AccountTests
{
[TestMethod()]
public void CurrentBallanceTestPositiveCase()
{
IAccount account = new Account();
account.Deposit(100);
double result = account.CurrentBallance;
Assert.AreEqual(100, result);
}
[TestMethod()]
public void DepositTestPositiveCase()
{
IAccount account = new Account();
double result = account.Deposit(100);
Assert.AreEqual(100, result);
}
[TestMethod()]
[ExpectedException(typeof(ArgumentException))]
public void DepositTestNegativeAmount()
{
IAccount account = new Account();
double result = account.Deposit(-100);
}
[TestMethod()]
public void WithdrawTestPositiveCase()
{
IAccount account = new Account();
account.Deposit(500);
double result = account.Withdraw(400);
Assert.AreEqual(100, result);
}
[TestMethod()]
[ExpectedException(typeof(ArgumentException))]
public void WithdrawTestNegativeWithdrawAmount()
{
IAccount account = new Account();
account.Deposit(200);
double result = account.Withdraw(-300);
}
[TestMethod()]
[ExpectedException(typeof(ArgumentException))]
public void WithdrawTestWithMoreWithdrawAmountThanDeposit()
{
IAccount account = new Account();
account.Deposit(200);
double result = account.Withdraw(300);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment