Initial commit: TDD Workshop exercises for participants
- Password Validator kata with starter code and tests - Shopping Cart kata with starter code and tests - FizzBuzz reference code (from live demo) - Setup guide and TDD reference card - No solutions included (participants implement themselves)
This commit is contained in:
commit
3d94c96ed2
13 changed files with 1469 additions and 0 deletions
25
password_validator/lib/password_validator.dart
Normal file
25
password_validator/lib/password_validator.dart
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
// TODO: Implement PasswordValidator using TDD.
|
||||
//
|
||||
// Rules (implement one at a time, test first!):
|
||||
// 1. Must be at least 8 characters long
|
||||
// 2. Must contain at least one uppercase letter
|
||||
// 3. Must contain at least one digit
|
||||
// 4. Must contain at least one special character (!@#$%^&*)
|
||||
// 5. Must not contain spaces
|
||||
//
|
||||
// ValidationResult holds a pass/fail flag AND a list of error messages.
|
||||
// Never return a boolean — the caller deserves to know *why* it failed.
|
||||
|
||||
class ValidationResult {
|
||||
final bool isValid;
|
||||
final List<String> errors;
|
||||
|
||||
const ValidationResult({required this.isValid, required this.errors});
|
||||
}
|
||||
|
||||
class PasswordValidator {
|
||||
ValidationResult validate(String password) {
|
||||
// TODO: implement
|
||||
throw UnimplementedError();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue