~/talk

.NET Testing Best Practices

Talkat NDC Sydney 2024 · 2024-02-12..02-16· [testing]
slides:none on file

Live-codes a small ASP.NET Core light-switcher, replaces a Singleton with constructor DI, adds an ITimePeriod helper and an enum to remove magic strings, and drives fixes via unit tests that move from many red failures to 11 passing tests then 18 passing tests. Tests use xUnit, Moq and FluentAssertions, run locally and in CI via GitHub Actions with a JUnit test-logger export. Dockerized test runs and build artifacts are demonstrated and the repo + start/done code are on GitHub.

AI-written summary · about

  1. 0:00Introduction
  2. 1:07Live coding setup
  3. 3:15First unit test project
  4. 6:48Arrange Act Assert pattern
  5. 9:20Testing light switcher
  6. 14:18Motion detection tests
  7. 20:22Removing Singleton pattern
  8. 25:03Test implementation details
  9. 28:40Testing light actuator
  10. 33:50AutoFixture for dependencies
  11. 38:59Debugging with mocks
  12. 42:11Turn off functionality
  13. 47:15Fixing magic strings
  14. 50:06Green build
  15. 51:30GitHub Actions pipeline
  16. 57:24CI build pipeline
  17. 1:00:00Q&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.