Code coverage differ than MS code coverage

Code coverage differ than MS code coverage

Hi,

I have a complex project that gets 50% code coverage using the default MS test coverage, but I only get 4% coverage under NCover.

Could someone point me to the right direction on what to look for?


RE: Code coverage differ than MS code coverage

You most likely have additional assemblies that are being counted in the percentage.

Load the coverage file into NCover and exclude the assemblies that were not counted in MSTest and see if the numbers are +/- 1%.

If they are, you can use exclusions to remove these in future executions.


RE: Code coverage differ than MS code coverage

Thank you jefohio1.

I am new to the NCover, how do I exclude the assemblies from NCover?

Also I am only looking at the coverage for one of the projects in the whole solution. Here is an example, the code is said to be covered when using default MS-Test, but not using NCover.

I use Rhino.Mocks to mock the Rate object. When debugging the unit test, I can clearly step into the if statement. But NCover says only the block is visited but nothing is covered within the if statement

private void ApplyMultipliers(Rate rate) { if (rate.Multiplier.HasValue) { if (rate.RateA.HasValue) rate.RateA = rate.RateA.Value * rate.Multiplier.Value; if (rate.RateB.HasValue) rate.RateB = rate.RateB.Value * rate.Multiplier.Value; if (rate.RateC.HasValue) rate.RateC = rate.RateC.Value * rate.Multiplier.Value; } }