您选择什么工具来创建存根?
继我的上一个问题“什么是“存根”之后,我真的很想坐下来今晚,更多地尝试创建存根对象。
您选择什么工具来创建存根对象?
奖励积分:)
您还可以链接到任何好的入门教程吗?
还有 很多男孩和女孩,赞赏:)
仅供参考 - 我正在使用 .NET(2.0 @ Work,3.5 @ Home)
Following on from my last question "What is a "Stub", I would really like to sit down tonight and play more with creating stub objects.
What is your tool of choice for creating Stub objects?
And for bonus points :)
Can you also link to any good tutorials for getting started with them?
Thanks a lot guys and girls, appreciated :)
FYI - I am using .NET (2.0 @ Work, 3.5 @ Home)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
简单来说,Rhino.Mocks。 是的,“Mocks 不是 Stubs”,但是 Rhino.Mocks 两者都做到了。 在我开始思考 Rhino.Mocks 之前,我手工编写了自己的存根。 再也不。
抱歉,我没有获得奖励积分。 Ayende.com 是获取 Rhino.Mocks 的地方,拥有不错的在线文档和一个充满问题的论坛。 作者其实也很擅长回应和回答。 我觉得学习如何使用它没有一个好的“捷径”; 为此,我认为最好是通过实践和/或反复试验来学习。
(在重读上面的内容时,我并不是说它听起来像 RTFM,尽管它可能是这样的。)
Simply, Rhino.Mocks. Yes, "Mocks Aren't Stubs", but Rhino.Mocks does both. Before wrapping my brain around Rhino.Mocks I hand-coded my own stubs. Never again.
Sorry, I don't get the bonus points. Ayende.com, the place to get Rhino.Mocks, has decent online documentation, and a forum full of questions. The author is actually very good at responding and answering too. I don't feel like there's a good "shortcut" to learning how to use it; for this I think it's through practice and/or trial-and-error that it's best learned.
(In rereading the above, I don't mean it to sound like RTFM even though it may come across that way.)
我已经使用 Rhinomocks 一段时间了。 它的问题在于它允许使用各种不同的策略和语法来创建模拟和存根。 对象模型变得挤满了仅在某些上下文中有用的各种扩展方法、函数和对象。 这使得学习变得更加困难。
我是 AAA 语法的粉丝,所以我可能会在下一个项目中切换到 Moq,它比 rhino 模拟更新一点。 它从 rhinomocks 中窃取了一些好主意,但没有 rhinomocks 多年来收集的旧东西。 如果您是嘲笑和存根的新手,我当然会研究一下。
I have used Rhinomocks for some time now. The problem with it is that it allows all kinds different of strategies and syntaxes for creating mocks and stubs. The object model is getting kind of crowded with all kinds of extension methods, functions and objects that are only useful in certain contexts. This makes it harder to learn.
I'm a fan of the AAA syntax so I'll probably switch to Moq for my next project, it's a bit newer than rhino mocks. It has stolen a couple of good ideas from rhino mocks but has none of the old cruft that rhinomocks has collected over the years. If you're new to mocking and stubbing I'd certainly look into it.
继我对 JMD 的回答的评论之后..
我一直在检查Rhino Mocks,我之前听说它也有存根功能,所以检查一下它是如何工作的是有意义的。
我没有机会用这些代码生成太多代码,但这里有一些我发现的有用链接(到目前为止):
Following on from my comment on JMD's Answer..
I have been checking out Rhino Mocks, I have heard before that it also has stub functionality, so it would make sense to check out how that works.
I have not had a chance to produce much code with these, but here are some useful links I have found (thus far):
RhinoMocks 很棒而且非常完整,但我发现 moq 更容易学习并使用。
我也使用 RhinoMocks,它很棒,但我想我发现 moq 的 API 非常容易发现,而且(简短的)文档非常有帮助。 甚至 Phil Haack 也不是当他将 RhinoMocks 与 Moq 进行比较时,他意识到了 RhinoMocks 的所有功能,Moq 是关于可发现性的声明。
RhinoMocks is great and very complete, but I found moq was much simpler to learn and use.
I also use RhinoMocks, and it's great, but I guess I find moq's API very discoverable, and the (short) documentation very helpful. Even Phil Haack wasn't aware of all of RhinoMocks' capabilities when he compared it to Moq, which is a statement about discoverability.
我们为 Pex 开发了一个存根框架,您可以在 http://research.microsoft 阅读(和学习)相关内容.com/stubs。 该框架在很多方面与 Rhino/Moq 不同:它“仅”用于生成存根和源代码。
We've developed a stub framework for Pex that you can read (and learn) about at http://research.microsoft.com/stubs. This framework is different in many ways from Rhino/Moq: it's 'just' for stubs and source code generated.