Reputation: 25
I have a number of classes in my project. When I check Code Coverage result after running the unit test cases, it does not show all the classes. I am not sure what are the criteria on which the code coverage process the class files.
I read somewhere that if you have not created the test cases for a class file in your Test project it will not be covered in the code coverage. But for me it does not seem true as I can see the the class files even though those are not in the test project.
Upvotes: 2
Views: 968
Reputation: 1977
A bit late in the day, but if you have a class that consists entirely of auto-properties, then this class won't be included in the code coverage stats.
Included
private int _seq;
public int InvoiceSequenceNumber
{
get
{
return _seq;
}
set
{
_seq = value;
}
}
Not included
public int InvoiceSequenceNumber { get; set; }
Upvotes: 1
Reputation: 12837
there are couple of ways to exclude files from code coverage, most popular being an attribute:
[ExcludeFromCodeCoverage]
Upvotes: 1