犀牛模拟:存根和嘲笑。有什么区别
我在单元测试中使用 Rhino Mocks。
我想知道 STUBS 和 MOCKS 之间的区别(mocks.Stub
和 mocks.StrictMock
)。
I'm using Rhino Mocks in my unit test.
I would like to know the difference between STUBS and MOCKS (mocks.Stub<T>()
and mocks.StrictMock<T>()
).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想以前就有人问过。
它通常是相同的,但有以下区别:
Stub
、Expect
或AssertWasCalled
。此行为也可以在普通模拟上配置。但对于存根来说,这是默认值。由于Rhino更改为AAA语法,因此不鼓励使用严格模拟,因为它们使测试代码非常难以维护。
类似问题:
我找不到有关Rhino实现的信息,所以我没有将此问题标记为重复。
I think it had been asked before.
It is generally the same with the following differences:
Stub
,Expect
norAssertWasCalled
on properties. This behaviour can also be configured on a normal Mock too. But for stubs it is the default.Since Rhino changed to AAA syntax, it is discouraged to use Strict Mocks, since they make test code very hard to maintain.
Similar questions:
I can't find the information about the Rhino implementation, so I don't mark this question as duplicate.