使用 NUnit 驱动 NDepend

发布于 2024-07-12 07:16:34 字数 255 浏览 5 评论 0原文

是否可以使用 NUnit 通过 NDepend 运行 CQL 查询? 如果能够将 NDepend dll 包含在 UnitTests 库中并编写如下测试,那就太好了:

[Test] public void
DomainAssemblyHasNoDatabaseDependencies
...

或类似的东西。

这将使与 Team City 集成变得非常容易,并且如果任何静态分析测试失败,构建会自动失败。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

假扮的天使 2024-07-19 07:16:34

这要归功于随 NDepend v4 一起发布的 NDepend.API,特别感谢命名空间 NDepend.CodeQuery 包含以下内容以编程方式运行 CQLinq 或 CQL 代码查询和以简单字符串形式呈现的规则所需。

这里是 NDepend.API 入门文档

我们建议查看名为 Query Code with CQLinq 的 PowerTool 源代码,可在 $NDependInstallPath$\NDepend.PowerTools.SourceCode\NDepend.PowerTools.sln 中找到

。借助 NDepend.API,您还可以直接使用 C# 或 VB.NET 代码编写代码查询/规则,甚至静态分析器(因此可以嵌入单元测试中的代码)。

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.SourceCode\NDepend.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).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文