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

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

问题描述

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

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

推荐答案

Pex使用Moles进​​行隔离(模拟).人们仍然可以与Moles一起使用MoQ.实际上,最好在代码允许的情况下使用MoQ之类的框架进行存根和模拟,仅Moles保留MoQ无法隔离的东西(密封类,非虚拟方法,私有成员等).

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 and Moles项目的成员)提到在

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天全站免登陆