It’s great to have your code covered by tests, right? And if you’re like me, you’d like to know how much of your code gets covered, the higher this metric, the lower the chance of having undetected software bugs, assuming your tests are good quality, of course.
Sometimes you need to exclude some classes from this metric to get more accurate results according to your project specifics.
For a .NET Core project, the framework provides the attribute
ExcludeFromCodeCoverage. Tag your class with it and make sure to add the import to
This attribute is available to .NET Core 2.0 or superior.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|public class YourClass|