Driving NDepend with NUnit

Is it possible to use NUnit to run CQL queries using NDepend? It would be nice to be able to just include the NDepend dlls in a UnitTests library and write tests like:

[Test] public void
DomainAssemblyHasNoDatabaseDependencies
...

or something similar.

This would make it very easy to integrate with Team City, and automatically fail the build if any of the static analysis tests fail.


This is possible thanks to NDepend.API released with NDepend v4, and especially thanks to the namespace NDepend.CodeQuery that contains what is needed to run programatically CQLinq or CQL code queries and rules presented as a simple string.

Here is documentation to get started with NDepend.API.

We advise looking at the source code of the PowerTool named Query Code with CQLinq available in $NDependInstallPath$NDepend.PowerTools.SourceCodeNDepend.PowerTools.sln

Notice finally, that thanks to NDepend.API, you can also write directly your code queries/rules or even static analyzer with C# or VB.NET code (hence code that can be embedded in your unit tests).

链接地址: http://www.djcxy.com/p/42228.html

上一篇: Flash加载两次解决方法?

下一篇: 用NUnit驱动NDepend