Learn about the key ingredients to unit testing with a quick overview of what it is and why it's good. Receive an overview of what Inversion of Control (IoC) is, along with the language specifics, which are covered in the IoC container setup portion of the course. Finally, see some examples of available ASP.NET Core IoC containers.
- [Instructor] Before we go into some TDD examples,…I'd like to go over some key components…that will help you understand how to write testable code.…Dependency Injection a key component…to writing clean, testable code.…Not only does it let you separate…your classes of responsibilities better,…but when you do it properly…it can also make writing your code easier too.…Now you'll often hear the terms Dependency Injection…and Inversion of Control used together.…They're usually shortened to DI and IoC.…Let's talk a little bit about what these terms mean…and then we'll go over some examples.…
IoC is a design principle.…It basically states that your framework should be…responsible for creating and calling your classes.…Dependency Injection is a design pattern where your classes…are provided the dependencies they need to run.…Dependency Injection is actually a form of IoC.…Here we have an MVC controller called HomeController.…All it does is log a message before returning a view.…But I'd like to draw your attention to the Constructor.…
Note: Examples in this course were developed using C# ASP.NET Core, but the concepts apply to all .NET Core applications.
- Getting the TDD tools
- Testing cases
- Refactoring code
- Completing test cases
- Testing changes in untested code
- Changing code