Moq vs NSubstitute: syntax cheat sheet
Moq and NSubstitute are two of the most used library to mock dependencies on your Unit Tests. How do they differ? How can we move from one library to the other?
Moq and NSubstitute are two of the most used library to mock dependencies on your Unit Tests. How do they differ? How can we move from one library to the other?
Code coverage is a good indicator of the health of your projects. We'll see how to show Cobertura reports associated to your builds on Azure DevOps and how to display the progress on Dashboard.
DateTime, Guid, and Random values are not under your direct control. You should abstract them to write better code and testing. We'll see 3 ways to inject and test them in .NET Core projects.
Code coverage is an indicator of the quality of your code. With Coverlet and VS2019 you can have a human readable report to see where to improve your code.
Integration tests are useful to check if multiple components fit together well. How can you test your APIs? And how can you mock dependencies?
Sometimes on your tests you need to access test files, for example for mocking external data. With manifest resources you can easily reference files for your tests.
The CollectionAssert class if fine for basic tests on collections in C#. We will have a look at the methods exposed by this class.
The StringAssert class is a hidden feature of the MSStest framework. Not so many methods, but they can help you with basic tests with strings.
The Assert class is the first step you'll probably take into unit testing. But do you know that there's more than the IsTrue() method?