- Offers practical advice in creating tests to quickly detect and resolve issues when writing portable code
- Uncovers code integration issues that improve code quality by using continuous integration
- Set up and use data-driven unit testing to verify your code over a range on inputs
This book enables developers to create robust, production-ready C# 7 and .NET Core applications by establishing a professional test-driven development process. To do this, we will begin by learning the stages of the TDD lifecycle, some best practices, and some anti-patterns.
After covering the basics of TDD in the first chapter, we will get right into creating our ASP.NET Core MVC sample application. We will learn how to write testable code with SOLID principles, and will set up dependency injection for our sample application. Next, we will take a good look at the xUnit testing framework, and learn how to use its attributes and assertions. When we start writing our tests, we will learn what "Fact" vs. "Theory" means in .NET Core unit testing, as well as how to use each. When we get the basic in place, we will learn how to create data-driven unit tests and how to mock dependencies in our code. We will learn the differences between running and debugging our tests on .NET Core on LINUX, versus Windows and Visual Studio. We will wrap up by creating a healthy continuous integration process for our sample application, using GitHub, TeamCity, and Cake. Finally, we will modify the CI build to test, version, and package our sample application.
What you will learn
- Write flexible, maintainable, verifiable code for .NET Core
- Learn how to write testable code using SOLID principles and dependency injections
- Recognize the characteristics of a good unit test
- How to structure and group your unit test
- Use mock objects to handle dependencies
- How to set up a continuous integration process from end-to-end