To a visual studio solution with 6 projects (class libraries & wcf services) I add a new Test project with one test, with just one line Assert.AreEqual(1,1). OpenCover shows a 100% coverage (100% Sequence and 100% Branch).
OpenCover.Console.exe -target:"nunit3-console.exe" "-targetargs:Services.nunit" -register:user -skipautoprops -mergebyhash
Only when I instantiated a class from the other projects in the test the coverage dropped to 0.1 %.
So looks like if a dll is not loaded, OpenCover cannot calculate its code coverage.
Now the question is if a new class library is added and it is never instantiated in a unit test, Will OpenCover just ignore the dll while calculating the coverage metrics.
This is important because we have a distributed team and a developer might just create a class library and never write tests for it. It does eventually show up in code reviews, but can OpenCover be configured to detect this situation.
So looks like if a dll is not loaded, OpenCover cannot calculate its code coverage.
This is expected behaviour
Now the question is if a new class library is added and it is never instantiated in a unit test, Will OpenCover just ignore the dll while calculating the coverage metrics.
It doesn't ignore it, the runtime doesn't load the assembly and so OpenCover does not see it.
It does eventually show up in code reviews, but can OpenCover be configured to detect this situation.
Not as it stands but you could write a test that tries to load every .dll in its folder. This will cause it to load and OpenCover will see it (assuming the pdb s available and the filters allow it etc etc)