.NET 中的模拟/存根非虚拟方法
存在哪些 .NET 模拟或存根框架可以存根非虚拟(甚至静态)方法,例如 Microsoft
What .NET mocking or stubbing frameworks exist that can stub non-virtual (or even static) methods like Microsoft Moles? It would be nice to have something like RhinoMocks AssertWasCalled
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我知道两个:
I know of two:
事实上,还有一个: Justmock
我尝试过这 3 个框架,最后选择了 Moles。确实,它只是存根,你的工作是将它们更改为模拟,但最终它并不太难(即使我发现教程不够清晰)。
已经有关于选择什么框架的主题,例如此处。
如果您确实想要在通话中进行预编程验证,请花钱购买 Justmock 或 Typemock(更贵,但仍然是领先者)。
In fact, there is one more : Justmock
I've tried those 3 frameworks and I chose Moles. It's true that it only stub things and it's your job to change them into mocks, but finally it's not too hard (even if I found that the tutorial was not enough clear).
There are already topics on what framework to choose, like here.
If you really want pre-programmed verifications on your calls, spend money for Justmock or Typemock (more expensive but still the leader).