排除程序集中的文件被修改
我正在使用鼹鼠为我的团队使用的遗留代码生成模拟类。是否有可能排除议会中的某些阶级受到调侃?对于遗留代码中的一些自动生成的类,我遇到了很多错误,我想将其排除在外。
I am using moles to generate mock classes for the legacy code my team uses. Is it possible to exclude certain classes in the assembly from being moled? I am getting a lot of errors for some autogenerated classes we have in the legacy code which I want to exclude from being moled.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要在存根/摩尔生成中包含和排除类型,您需要修改程序集的 .moles 文件。尽管参考手册的“类型过滤”部分仅描述了
StubGeneration
元素,但还有MoleGeneration
元素,其工作原理类似,但管理摩尔生成。要从存根和摩尔生成中排除某种类型,请在
Remove
元素中指定类型名称,以便程序集的 .moles 文件如下所示:以下是如何仅为一个类启用存根和摩尔生成<代码>您的类型.全名:
To include and exclude types from stub/mole generation, you need to modify the .moles file for your assembly. Although the section "Type Filtering" of the reference manual describes only the
StubGeneration
element, there is also theMoleGeneration
element which works similarly but manages mole generation.To exclude a type from stub and mole generation specify the type name in a
Remove
element so that the .moles file for your assembly looks like this:Here's how to enable stub and mole generation only for one class
Your.Type.Full.Name
: