Check that the namespace N1.N2 is 100% covered by tests

Rule ND9911 Samples of Custom rules / Check Coverage on particular Code Elements

A sample rule checking that a particular namespace is 100% covered by tests; adapt @"N1.N2" and the threshold 100. Requires coverage data imported: https://www.ndepend.com/docs/code-coverage

How to fix

This is a sample rule, there is nothing to fix as is.

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>Check that the namespace N1.N2 is 100% covered by tests</Name>
// <Id>ND9911:ExplicitId9911</Id>

warnif count > 0 from n in Application.Namespaces where 
  (n.Name == @"N1.N2") && 
   n.PercentageCoverage < 100
select new { 
   n, 
   n.PercentageCoverage,
   Debt = n.NbLinesOfCodeNotCovered.ToMinutes().ToDebt(),
   Severity = Severity.High
}

//<Expl>
// The *{0}* is only *{1}* covered by tests while it should be 100% covered.
//</Expl>

//<Desc>
// A sample rule checking that a particular namespace is 100% covered by
// tests; adapt **@"N1.N2"** and the threshold **100**. Requires coverage
// data imported: https://www.ndepend.com/docs/code-coverage
//</Desc>

//<HowToFix>
// This is a *sample rule*, there is nothing to fix *as is*.
//</HowToFix>

Samples of Custom rules / Check Coverage on particular Code Elements: all 4 items