将 Pex 与 MoQ 集成 [英] Integrate Pex with MoQ

查看:23
本文介绍了将 Pex 与 MoQ 集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能指出一个资源,该资源显示了如何将 Pex 与 MoQ 结合使用的示例?谢谢

Can anyone point me to a resource that shows an example of how Pex can be used in conjunction with MoQ? Thanks

推荐答案

Pex 使用 Moles 进行隔离(模拟).人们仍然可以将 MoQ 与 Moles 一起使用.实际上,当代码允许时,最好使用像 MoQ 这样的框架来进行存根和模拟,只为 MoQ 无法隔离的东西(密封类、非虚拟方法、私有成员等)留下 Moles.

Pex uses Moles for isolation (mocking). One can still use MoQ alongside Moles. It's actually preferred to use a framework like MoQ for stubbing and mocking when the code can allow for it, leaving only Moles for the stuff MoQ can't isolate (sealed classes, non-virtual methods, private members, etc).

为了支持我的陈述,Peli de Halleux(Pex 和 Moles 项目的成员)提到在 MSDN 论坛.

To backup my statements, Peli de Halleux (a member of the Pex and Moles project), mentions doing the same thing over on MSDN forums.

我一直在使用 Moles,您可以在单元测试中同时使用这两个框架进行编码.但这可能没有太大帮助,因为您专门询问 Pex,我还没有尝试过.是否可以修改 Pex 创建的单元测试并在事后添加 MoQ 代码?

I have been using Moles and you can code with both frameworks in a unit test. But this probably isn't much help as you are asking specifically about Pex, which I haven't tried yet. Is it possible to modify the unit tests Pex creates and add the MoQ code after the fact?

这篇关于将 Pex 与 MoQ 集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆