Everyone knows by now that testing is a mandatory part of software development, but it's very easy to make it hard for yourself to write tests for the code you just wrote. Writing testable code is a craft practised by the most seasoned software engineers, and it is usually a sign of a clean codebase that uses modern practices. Nowadays, it is pretty easy to use AI coding assistants to write tests for you, but true engineers develop a deep understanding of how you can write testable code. In this course, Gui Ferreira will walk you through why writing testable code using C# is so important and show you step-by-step how you can learn this art and follow it for the code you write.
Welcome (01:32)
What will you learn in this course? (03:05)
Who is the course for and prerequisites (00:57)
The Cost of Untestable Code (05:49)
What makes Code "Testable Code" (08:53)
What is Unit Testing (02:52)
How to approach Testable Code (06:37)
Introduction (02:51)
Clear Inputs and Outputs (14:03)
Explicit Error Handling (11:18)
Separation of Construction and Logic (07:56)
Visible State Changes (05:38)
Exercise (03:09)
Section Recap (00:54)
Introduction (03:58)
Identifying and Extracting Responsibilities (10:09)
Dealing with Constructor Bloat (08:07)
Creating Effective Injection Points (13:34)
Injectable vs. Newable Objects (05:54)
Composition of Narrow Components (11:11)
Exercise (02:48)
Section Recap (01:24)
Introduction (04:58)
Working with Static Dependencies (09:13)
Breaking Dependency Chains (08:39)
Creating Abstractions for External Services (08:25)
Isolating Framework Code (06:31)
Exercise (01:46)
Section Recap (02:06)
Introduction (07:21)
Avoiding Test Interference (10:04)
Converting Static Dependencies to Testable Code (06:56)
Implementing Pure Functions (00:00)
Replacing Traditional Singletons (06:11)
Exercise (01:21)
Section Recap (01:33)
Introduction (01:12)
Writing Testable ASP.NET Core Controllers (15:08)
Designing Entity Framework Code for Testability (09:22)
Making Time-Dependent Code Testable (05:33)
Creating Testable External Dependencies (11:56)
Implementing Testable Authentication and Authorization (05:35)
Section Recap (02:30)
Conclusion (01:10)
Course Info
Lifetime access
Add to Cart
Guilherme Ferreira, also known as Gui, is a Minimalist Software Craftsman, passionate about simplicity and continuous learning. Gui is a Microsoft MVP for Developer Technologies, a Tech Speaker, a YouTuber, and a .NET content creator. With over 15 years of experience in software development, Gui went from Startups to Tech Giants. Along his journey, he got to know several hats, including Software Engineer, Architect, CTO, and Developer Advocate, gathering a diverse and invaluable skill set.
More courses by Gui Ferreira© 2025 Dometrain. All rights reserved.