Created
July 8, 2014 20:12
-
-
Save aevitas/944b21b524a93c2e47f4 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
[Subject(typeof(Inventory), "customer swapping garment")] | |
public class GarmentSpecifications | |
{ | |
private static Inventory _inventory; | |
Establish context = () => | |
{ | |
// Establish the context for our test case, set up the required objects, etc. | |
_inventory = new Inventory(); | |
_inventory.Add(GarmentColor.Black, 3); | |
_inventory.Add(GarmentColor.Blue, 2); | |
}; | |
// The mutation our test case performs, which should produce the asserted result. | |
// The "Because" (or Act) block should be the _only_ block to modify state! | |
Because of = () => _inventory.TradeIn(GarmentColor.Blue, GarmentColor.Black); | |
// We assert whether our premises are indeed correct. | |
It should_have_three_blue_garments_in_stock = () => _inventory.Stock[GarmentColor.Blue].ShouldEqual(3); | |
It should_have_two_black_garments_in_stock = () => _inventory.Stock[GarmentColor.Black].ShouldEqual(2); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment