~/talk

.NET Testing Best Practices

Talkat NDC Oslo 2024 · 2024-06-10..06-14· [testing]
slides:none on file

Adds unit tests to an ASP.NET Core sample using xUnit, Moq (with auto-mocking) and FluentAssertions, refactors a static singleton into constructor-injected ILightSwitcher and extracts ITimePeriodHelper so tests can control time-of-day. Implements parameterized theories, debugs failing cases, fixes a bug caused by string time names by introducing a TimePeriod enum, gets 13 passing tests locally, and emits JUnit XML from dotnet test for GitHub Actions test reporting.

AI-written summary · about

  1. 0:00Welcome to .NET testing
  2. 1:11Demo environment setup
  3. 2:32New xUnit test project
  4. 4:18First unit test with Fluent
  5. 7:52Arrange-act-assert pattern
  6. 8:14Motion detection testing
  7. 10:49xUnit theories for tests
  8. 12:36First test case
  9. 16:17Auto-run tests after build
  10. 18:02Debug failing tests
  11. 22:26Light switcher with mocks
  12. 25:39Extract time period logic
  13. 27:01Adding dependency injection to production code
  14. 29:16DI in tests with AutoFixture
  15. 34:39Debug tests for behavior
  16. 38:00Fixing bugs discovered through testing
  17. 39:26Refactor string enums
  18. 42:46Time edge case testing
  19. 43:28Time period tests
  20. 47:18Tests in DevOps pipeline
  21. 50:09GitHub Actions workflow
  22. 51:12Test reports generation
  23. 52:35CI pipeline results
  24. 53:40Add tests to projects
~/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.