personal-dotnet-testing
Installation
SKILL.md
.NET Testing Approach
This skill captures the approach, not a single library. The principles below apply regardless of which test runner, substitute library, or assertion library a project picks. Library routing is in §Library choices.
Per-layer strategy (Clean / Onion architecture)
- Domain - pure unit tests, no substitutes. Cover entities, value objects, domain services, domain events, invariants, guard clauses, factory methods, and every branch of business rules including exception paths. Target ~100%.
- Application - unit tests for use cases / handlers / services. Substitute all ports and abstractions. Cover success paths, validation failures, exception handling, and orchestration branches. Target 95%+.
- Infrastructure - test logic-bearing code only (mappers, parsers, serializers, policy classes, retry/backoff, non-trivial query logic). Use in-memory DB or Testcontainers when query logic is non-trivial. Do not write tests that only assert a substitute was configured.
- Integration / E2E - defined per project in project CLAUDE.md.
Coverage
- Default threshold: 90% line + branch across logic assemblies. Project CLAUDE.md may override.
- Coverage is computed after exclusions so the threshold reflects real logic coverage, not padding.