Assemblies and Namespaces should be tested

Rule ND1603 Code Coverage

Lists assemblies and namespaces not covered at all by unit tests (a matched assembly's children namespaces are not matched).

Its goal is to inform of large untested code elements — not to collide with Code should be tested, which details uncovered code, Debt and Annual Interest per method. Hence Debt is only 4 minutes per issue and severity is Low.

How to fix

Write unit and integration tests to cover, even partially, the matched elements. Then use Code should be tested, New Types and Methods should be tested and Methods refactored should be tested to write tests where they matter most, refactoring for testability if needed.

CQLinq source

This rule is written in CQLinq, C# LINQ over the NDepend code model. It ships with every new NDepend project: you can read it, adapt it, or use it as a starting point for your own custom rules.

// <Name>Assemblies and Namespaces should be tested</Name>
// <Id>ND1603:AssembliesNamespacesAndTypesShouldBeTested</Id>

warnif count > 0
from elem in JustMyCode.Assemblies.Concat(JustMyCode.Namespaces.Cast<ICodeElementParent>())
where elem.NbLinesOfCode > 0 &&
      elem.PercentageCoverage == 0 && 
      elem.Parent.PercentageCoverage != 0
orderby elem.NbLinesOfCode descending
select new { 
   elem, 
   elem.NbLinesOfCodeNotCovered,
   Debt = 4.ToMinutes().ToDebt(),
   Severity = Severity.Low
}

//<Expl>
//None of the {1} statement{1?:s} of the *{0}* {1?is:are} covered by a test.
//This issue will be considered as fixed when a first test will be written.
//Issues of the rule *Code should be tested* provide the details of statements to cover for each method.
//</Expl>
//<Desc>
// Lists assemblies and namespaces not covered at all by unit tests (a
// matched assembly's children namespaces are not matched).
//
// Its goal is to inform of large untested code elements — not to collide
// with **Code should be tested**, which details uncovered code, *Debt* and
// *Annual Interest* per method. Hence *Debt* is only 4 minutes per issue and
// severity is *Low*.
//</Desc>
//
//<HowToFix>
// Write unit and integration tests to cover, even partially, the matched
// elements. Then use **Code should be tested**, **New Types and Methods
// should be tested** and **Methods refactored should be tested** to write
// tests where they matter most, refactoring for testability if needed.
//</HowToFix>

Code Coverage: all 15 items