Reputation: 7414
I have a project that I ran the Visual Studio 2015 code coverage analysis against. In the results, it includes internal classes in the results hierarchy that I can't test against. I don't want to use the InternalsVisibleToAttribute
, but I also don't like that it's counted as part of the code coverage path.
Is there a way to have visual studio ignore internal classes, so that the code coverage results only includes public classes that I can actually touch with unit tests?
The CachedTypeData
is an internal sealed class with a series of generic methods. As you can above the type is included in my results, right next to two public classes, Autosave<T>
and EngineTimer<T>
.
Upvotes: 2
Views: 436
Reputation: 8725
No Visual studio
doesn't has such a capability however, you can put ExcludeFromCodeCoverage attribute on your Internal
classes.
Note: Visual Studio
's CCA measures the CC's percentage through the IL
, if your Classes under test
use an Internal
method/class then those Internal
method/class will be cover.
So in most cases you shouldn't split/exclude your Internal
classes.
Upvotes: 2