Check that the assembly Asm is 100% covered by tests

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

A sample rule checking that a particular assembly is 100% covered by tests; adapt @"Asm" 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 assembly Asm is 100% covered by tests</Name>
// <Id>ND9912:ExplicitId9912</Id>

warnif count > 0 from a in Application.Assemblies where 
  (a.Name == @"Asm") && 
   a.PercentageCoverage < 100
select new {
   a,
   a.PercentageCoverage,
   Debt = a.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 assembly is 100% covered by
// tests; adapt **@"Asm"** 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