Skip to content

Instantly share code, notes, and snippets.

@wahidshalaly
Created April 13, 2010 15:36
Show Gist options
  • Save wahidshalaly/364738 to your computer and use it in GitHub Desktop.
Save wahidshalaly/364738 to your computer and use it in GitHub Desktop.
private Account _account;
private decimal _openingBalance = 2500m;
private decimal _positiveAmount = 1000m;
private void Given_account_with_positive_balance()
{
string name = "Account Name";
string description = "Account Description";
_account = new Account(name, description, _openingBalance);
}
private void When_deposit_positive_amount()
{
_account.Deposit(_positiveAmount);
}
[Test]
public void Can_deposit_positive_amounts()
{
Given_account_with_positive_balance();
When_deposit_positive_amount();
// Then
// 1. Current balance should increase by deposited amount
Assert.AreEqual(_openingBalance, _account.OpeningBalance);
// 2. Opening balance should stay the same
Assert.AreEqual(_openingBalance + _positiveAmount, _account.CurrentBalance);
}
@wahidshalaly
Copy link
Author

This is second take of the BDD-like test case.
Using meaningful method names that can be reused in building different scenarios.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment