- MSpec (Machine.Specification)
DAMP & DRY
A good name is rather to be chosen...
Two things are hard, Cache Invalidation and naming things.
- DAMP: Descriptive And Meaningful Phrases
- DRY: Don't Repeat Yourself
Good Practice: Test Names
// Here's an example
public void MyFaveUnit_CalledWithGoodParm_ReturnsValidThing()
3 Part Harmony
Define your scenario
- Create Instances
- Mock Dependencies
- Initialize Expectations
- Call your Unit Under Test
AKA 'unit of work'
- 'Be Sure That' your expectations were met.
Test Driven Development
Write tests before you code
Even for objects and methods that do not yet exists
Red, Green, Refactor
- Red: Write an expectation that fails
- Green: Write the least code to pass
- Refactor: All Test MUST Pass, Always
More is good-er
There is a practical limit