.NET Testing Best Practices
summary
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
chapters (17)
- 0:00Introduction
- 1:07Live coding setup
- 3:15First unit test project
- 6:48Arrange Act Assert pattern
- 9:20Testing light switcher
- 14:18Motion detection tests
- 20:22Removing Singleton pattern
- 25:03Test implementation details
- 28:40Testing light actuator
- 33:50AutoFixture for dependencies
- 38:59Debugging with mocks
- 42:11Turn off functionality
- 47:15Fixing magic strings
- 50:06Green build
- 51:30GitHub Actions pipeline
- 57:24CI build pipeline
- 1:00:00Q&A
related talks
54m.NET Testing Best Practices
43m.NET Testing Best Practices
01h 04mClean Testing - Clean Architecture with .NET Core
58mTesting strategy for your ASP.NET Core micro-service
51mFallacies of Unit Testing
01h 02mTesting First - Getting The How
39mMake .Net Automation Great Again
52mxUnit Expanded – Better Testing With xUnit
