mirror of
https://github.com/bitwarden/server
synced 2026-01-27 14:53:21 +00:00
Refactor BaseRequestValidatorTests to use SutProvider pattern
- Replace manual constructor-based dependency injection with SutProvider<T> - Add [SutProviderCustomize] attribute to test class - Update all 25+ test methods to use sutProvider parameter - Handle FakeLogger special case with SetDependency<ILogger>() - Update CLAUDE.md with SutProvider advanced usage documentation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -114,6 +114,11 @@ Key testing utilities:
|
||||
- `SutProvider<T>` - Helper for creating system-under-test with mocked dependencies
|
||||
- `[SutProviderCustomize]` - Attribute to enable SutProvider pattern
|
||||
|
||||
**SutProvider advanced usage:**
|
||||
- **Parameter order with inline data**: `[BitAutoData("value")]` inline parameters come before `SutProvider<T>` in the method signature
|
||||
- **Non-mock dependencies**: Use `new SutProvider<T>().SetDependency<IInterface>(realInstance).Create()` when you need a real implementation (e.g., `FakeLogger`) instead of a mock
|
||||
- **Interface matching**: SutProvider matches dependencies by the exact interface type in the constructor
|
||||
|
||||
### Integration Tests
|
||||
Integration tests exercise real code paths with actual database operations. **Do not mock** - use real repositories and test helpers to set up data:
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user