Created
April 13, 2010 01:43
-
-
Save wahidshalaly/364228 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
[Test] | |
public void Can_deposit_positive_amounts() | |
{ | |
string name = "Account Name"; | |
string description = "Account Description"; | |
decimal openingBalance = 2500m; | |
decimal amount = 1000m; | |
// Given account | |
var account = new Account(name, description, openingBalance); | |
// When depositing positive amounts | |
account.Deposit(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 + amount, account.CurrentBalance); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Recently, I started to think of test cases in a BDD-like format.
Sometimes, I use Given/When/Then in test case name & sometimes I don't.
I try to keep names smaller & more focused.
For example, this test can be named like:
Given_positive_balance_When_deposit_positive_amount_Then_only_current_balance_increases
But I think the short name I used works better. What do u think?