Rhino 的嘲笑有哪些风格?
听说最新款式是AAA。还有其他的吗?为什么我们使用一种而不使用另一种?
I heard that latest style is AAA. Is there any other one? Why we use one and don't use another?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
通过检查模拟和存根之间的差异,可以最好地理解新 AAA 风格和旧记录/重放风格之间的差异。 AAA 使用存根,而录制/重放则使用模拟。
我在此处写了关于差异的博客。
The difference between the new AAA style and the old record/replay style is best understood by examining the difference between mocks and stubs. AAA uses stubs, while record/replay uses mocks.
I have blogged about the difference here.
我认为有两种主要风格 - 一种是经典风格(不确定名称是什么) - 从 .Net 的一开始和最早版本就存在(当然我在 .Net 1.1 中使用过它)和 AAA 风格。两者仍然功能齐全,所以请随意使用任何一个(但你不能混合它们 - 它根本不起作用,你会得到奇怪的错误)。
AAA 风格是在 C# 中引入 lambda 表达式和扩展方法之后发展起来的,很多人(包括我)认为它更干净,更容易阅读,并且更好地表达了测试的意图。
I think there are 2 major styles - one is the classic one (not sure what is the name) - which existed from the beginning and the earliest versions of .Net (certainly I used it with .Net 1.1) and the AAA one. Both are still fully functional, so feel free to use any (but you can't mix them - it simply doesn't work and you will get weird errors).
The AAA style was developed after lambda expressions and extension methods were introduced in C# and many people (including me) think it is cleaner, easier to read and expresses the intent of the test better.