~/talk

xUnit Expanded – Better Testing With xUnit

Talkat JetBrains .NET Day Online 2023 · on Tuesday, 2023-09-26· [testing, dotnet]
slides:none on file

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

  1. 0:00Introduction
  2. 1:04Talk purpose and outline
  3. 3:13Testing philosophy and goals
  4. 4:38How xUnit executes tests
  5. 6:01Demo setup and bookstore app
  6. 7:47Naming and structuring unit tests
  7. 10:12Variable naming in tests
  8. 11:55HTTP client mocking approaches
  9. 14:47Mocking with RichardSzalay.MockHttp
  10. 16:09Handling flaky tests and random data
  11. 18:17Benefits of random data
  12. 19:40Fluent assertions for complex checks
  13. 20:01Testing file uploads with combinatorial data
  14. 21:47xunit.combinatorial for edge cases
  15. 23:34Parsing CSV lines with Theory data
  16. 25:18Testing string parsing and edge cases
  17. 27:25Lottery service testing with Any()
  18. 29:11Fluent assertions for arguments
  19. 32:21Integration testing with databases
  20. 33:04Avoiding in-memory or SQLite providers
  21. 34:27Test containers for real databases
  22. 36:14Handling state bleed in tests
  23. 37:59Database cleanup with Respawn
  24. 39:24Libraries and patterns recap
  25. 40:29Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.