Chapter 17: Unit Testing
Throughout this book, you have learned all you need to know to be able to program using the C# language—from statements to classes, from generics to functional programming, from reflection to concurrency, and many others. We also covered many topics related to .NET Framework and .NET Core, including collections, regular expressions, files and streams, resource management, and Language Integrated Query (LINQ).
However, a key aspect of programming is making sure that code behaves as intended. Code that is not properly tested is prone to unexpected bugs. There are various types and levels of testing, but the one typically performed by developers while developing is unit testing. This is the topic covered in this final chapter of this book. In this chapter, you will learn what unit testing is and what are the built-in tools available to write unit tests for C#. Then, we will look in detail at how we can leverage these tools to unit test our C# code.
...