Tdd Fundamentals · TL;DR

1 min read
Mid-level19 min read
Rapid overview

TL;DR

TopicKey Takeaway
Red-Green-RefactorDiscipline of small steps: fail, pass, improve
TDD vs Test-First vs Test-LastTDD drives design; test-last is acceptable with discipline
xUnitModern default; [Fact]/[Theory], constructor lifecycle, parallel by default
AAA PatternArrange-Act-Assert keeps tests readable and diagnosable
Mocking (Moq / NSubstitute)Control inputs (stubs) and verify outputs (mocks)
Test DoublesKnow dummy/stub/mock/spy/fake — interviewers test vocabulary
Integration TestingWebApplicationFactory for APIs; Testcontainers for real infra
Async TestingAlways use async Task; never .Result or .Wait()
Code CoverageTarget risk, not percentages; 100% is a vanity metric
BDD / SpecFlowLiving documentation for complex business rules
Anti-PatternsTest behavior, not implementation; keep tests fast and focused
Property-Based TestingVerify invariants over random inputs with FsCheck
Mutation TestingStronger quality signal than coverage; use Stryker.NET

See also