Initial commit: Complete TDD workshop materials
- Workshop documentation (WORKSHOP_PLAN, FACILITATOR_GUIDE, etc.) - FizzBuzz kata with demo script (git history to be recreated) - Password Validator kata with demo script and solution - Shopping Cart kata with demo script and solution - Setup guide and TDD reference card for participants
This commit is contained in:
commit
c3355063f2
26 changed files with 4725 additions and 0 deletions
43
password_validator/README.md
Normal file
43
password_validator/README.md
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
# Feature A — Password Validator
|
||||
|
||||
## Your goal
|
||||
|
||||
Implement `PasswordValidator` using strict TDD. **Do not write any production code before you have a failing test.**
|
||||
|
||||
## Rules to implement (in order)
|
||||
|
||||
| Step | Rule | Error message |
|
||||
|------|------|---------------|
|
||||
| 1 | At least 8 characters long | `Must be at least 8 characters long` |
|
||||
| 2 | At least one uppercase letter (A–Z) | `Must contain at least one uppercase letter` |
|
||||
| 3 | At least one digit (0–9) | `Must contain at least one digit` |
|
||||
| 4 | At least one special character (`!@#$%^&*`) | `Must contain at least one special character (!@#$%^&*)` |
|
||||
| 5 | No spaces | `Must not contain spaces` |
|
||||
| 6 | All errors reported at once (refactor) | — |
|
||||
|
||||
## The rhythm — repeat for every rule
|
||||
|
||||
```
|
||||
1. Uncomment the next test → run → watch it FAIL (Red)
|
||||
2. Write the minimum code to make it pass → run → GREEN
|
||||
3. Refactor if needed → run → still GREEN
|
||||
4. Move to the next test
|
||||
```
|
||||
|
||||
## Running the tests
|
||||
|
||||
```bash
|
||||
dart pub get
|
||||
dart test
|
||||
```
|
||||
|
||||
## Files
|
||||
|
||||
- `lib/password_validator.dart` — your implementation goes here
|
||||
- `test/password_validator_test.dart` — uncomment tests one at a time
|
||||
|
||||
## Hint for Step 6 (the refactor insight)
|
||||
|
||||
Once all 5 rules pass, you'll likely have 5 separate `if` blocks in `validate()`.
|
||||
Think about how to represent each rule as **data** instead of **code**.
|
||||
What if each rule were just a function in a list?
|
||||
Loading…
Add table
Add a link
Reference in a new issue