C# Unit Testing Best Practices for Great Code Coverage

Описание к видео C# Unit Testing Best Practices for Great Code Coverage

☄️ Master the Modular Monolith Architecture: https://bit.ly/3SXlzSt
📌 Accelerate your Clean Architecture skills: https://bit.ly/3PupkOJ
🚀 Support me on Patreon to access the source code:   / milanjovanovic  

In this video, I will show you how to unit-test domain services. Unit testing domain services is easy since most dependencies will be injected as interfaces. We will use NSubstitute to provide mocks while unit testing and use FluentAssertion to verify that our services behaved as expected. I'll also discuss code coverage and why you don't want to focus on that specific metric. Instead, focus on writing high-quality unit tests.

Join my weekly .NET newsletter:
https://www.milanjovanovic.tech

Read my Blog here:
https://www.milanjovanovic.tech/blog

Chapters
0:00 What are we going to test?
1:08 Implementing the first test case
4:10 Improving the test class setup
5:50 Implementing the second test case
7:11 Mocking external dependencies with NSubstitute
11:09 Writing the test case for the happy path
12:47 How to verify method calls on your mock with NSubstitute
15:50 Code coverage report - just focus on writing good unit tests

Комментарии

Информация по комментариям в разработке