xUnit Expanded – Better Testing With xUnit
summary
Shows concrete patterns and libraries for C# testing: uses xUnit with collections and class fixtures for parallelism, prefers Arrange‑Act‑Assert naming and explicit expected/actual variables, and advocates AutoFixture for randomized inputs that caught an enum bug (month 0 vs 1). Demonstrates three HTTP mocking approaches and recommends RichardSzalay.MockHttp over fragile reflection hacks, uses FluentAssertions.BeEquivalentTo for deep asserts, and runs Postgres in Docker with Testcontainers + Respawn to reset state quickly (suite ~733ms).
AI-written summary · about
chapters (25)
- 0:00Introduction
- 1:04Talk purpose and outline
- 3:13Testing philosophy and goals
- 4:38How xUnit executes tests
- 6:01Demo setup and bookstore app
- 7:47Naming and structuring unit tests
- 10:12Variable naming in tests
- 11:55HTTP client mocking approaches
- 14:47Mocking with RichardSzalay.MockHttp
- 16:09Handling flaky tests and random data
- 18:17Benefits of random data
- 19:40Fluent assertions for complex checks
- 20:01Testing file uploads with combinatorial data
- 21:47xunit.combinatorial for edge cases
- 23:34Parsing CSV lines with Theory data
- 25:18Testing string parsing and edge cases
- 27:25Lottery service testing with Any()
- 29:11Fluent assertions for arguments
- 32:21Integration testing with databases
- 33:04Avoiding in-memory or SQLite providers
- 34:27Test containers for real databases
- 36:14Handling state bleed in tests
- 37:59Database cleanup with Respawn
- 39:24Libraries and patterns recap
- 40:29Q&A
related talks
54m.NET Testing Best Practices
53mThe secret unit testing tools no one ever told you about
47mThe secret unit testing tools no one ever told you about
39mIdentifying and Testing Details That Matter Using Automated Tests
48mHow to Love Unit Testing
46mUnit-Testing With Ease
44mTesting the untestable - patterns and use cases analysis
01h 02mTesting First - Getting The How
