相关疑难解决方法(0)

如何清除对象的先前期望?

我想设置一个返回值

_stubRepository.Stub(Contains(null)).IgnoreArguments().Return(true);
Run Code Online (Sandbox Code Playgroud)

但是在特定测试中,覆盖该期望返回false.

就像是:

_stubRepository.ClearExpectations();  //<- this does not exist, I'm just making something up
_stubRepository.Stub(Contains(null)).IgnoreArguments().Return(false);
Run Code Online (Sandbox Code Playgroud)

注意,我不希望第二次调用时返回false,我想覆盖第一个期望.

这将有助于大大简化我的测试场景.

.net rhino-mocks

62
推荐指数
3
解决办法
1万
查看次数

标签 统计

.net ×1

rhino-mocks ×1