Created
April 13, 2010 15:36
-
-
Save wahidshalaly/364738 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is second take of the BDD-like test case.
Using meaningful method names that can be reused in building different scenarios.