In this chapter, we have learned about writing unit test cases for async methods, which helps in achieving robust code, supporting large teams, and adapting to new CI/CD platforms, which helps in finding issues at a very early stage. We started by introducing a few problems that you may come across while writing unit test cases for parallel and async code and how you can mitigate them using correct coding practices. Then, we moved on and looked at mocking, which is a very important aspect of unit testing.
We learned that Moq has support for .NET Core and that .NET Core is evolving very fast; soon, there will be support for all the major mocking frameworks. All the steps for writing test cases were explained as well, including installing Moq as a NuGet package and setting up data for mock objects. Finally, we explored the features of an important testing tool, Test Explorer...