各有什么主要的嘲弄框架的现实世界的利弊?利弊、各有、框架、现实

2023-09-02 01:44:25 作者:╯幸福°持有者

又见What我应该考虑的时候   选择一个嘲讽框架   净

see also "What should I consider when choosing a mocking framework for .Net"

我试图决定嘲弄的框架,在.NET项目,我最近也开始使用。我想我的速度在不同的框架研究。我最近读到这篇博客文章http://$c$cvanced.net/post/Mocking-frameworks-comparison.aspx并想知道如果任何StackOverflow的观众有什么在现实世界中的优势和注意事项的框架的方式添加。

I'm trying to decide on a mocking framework to use on a .NET project I've recently embarked on. I'd like to speed my research on the different frameworks. I've recently read this blog post http://codevanced.net/post/Mocking-frameworks-comparison.aspx and wondered if any of the StackOverflow audience has anything to add in the way of real-world advantages and caveats to the frameworks.

难道人们可以列出他们要么正在使用或已经调查了自己的.NET项目中使用的嘲讽框架的优点/缺点。我认为这将不仅是一个帮助我来决定我目前的项目,但它会帮助挑选正确的框架,他们的情况,当其他人做出更明智的决策。我不是一个专家在任何框架,但我希望得到支持和反对我遇到的主要框架:

Could people could list the pros/cons of the mocking frameworks they either currently use or have investigated for their own use on .NET projects. I think this would be not only a help to me to decide for my current project, but it will help others make more informed decisions when picking the correct framework for their situation. I'm not an expert on any of the frameworks but I would like to get arguments for and against the major frameworks I've come across:

RhinoMocks 起订量 TypeMock隔离 NMock 摩尔

和我已经错过了其他可用的替代品。我也想从已经切换用户的见解或因使用问题产品停止。

And other usable alternatives that I've missed. I'd also like insights from users that have switched or stopped using products because of issues.

推荐答案

我不知道痣所有,但我将那些我大概了解了一下(我真的需要这样的表,虽然)。

I don't know Moles at all, but I'll cover the ones I know a bit about (I really need a table for this, though).

起订量

赞成的

类型安全 一致的界面 在鼓励优秀的设计

缺点的

在不作为全功能的一些竞争对手 在不能嘲笑代表 在它不能做有序的预期 在可能其他的东西我想不出现在... Not as full-featured as some of its competitors It can't mock delegates It can't do ordered expectations probably other things I can't think of right now...

犀牛制品

赞成的

类型安全 全面的功能集 在鼓励优秀的设计

缺点的

混淆API。有太多不同的方式做同样的事情,如果你把他们在错误的方式,它是行不通的。 只能模拟接口和虚拟/抽象成员

TypeMock隔离

赞成的

类型安全(AFAIR) 可以模拟的什么的

缺点的

非常侵入 潜在供应商锁定 在不鼓励良好的设计

NMock

赞成的

在鼓励优秀的设计 在任何版本的.NET(甚至1.1)的作品

缺点的

不是类型安全 只能模拟接口和虚拟/抽象成员

请注意,特别是优势,就TypeMock缺点是极具争议性。我发表我自己就此事项在我的博客。

Please note that particularly the advantages and disadvantages regarding TypeMock are highly controversial. I published my own take on the matter on my blog.

我开始了NMock时是唯一的选择,早在2003年,然后迁移,因为它的类型安全,以犀牛嘲笑,而现在使用,因为简单的API的起订量。

I started out with NMock when that was the only option back in 2003, then migrated to Rhino Mocks because of its type safety, and now use Moq because of the simpler API.