【发布时间】:2012-07-06 13:17:58
【问题描述】:
我经常遇到一个问题,这与 Rhino Mocks 强制您在可用时使用 setter 而不是模拟(反之亦然)的方式有关。
例如:
var foo = MockRepository.GenerateStub<IFoo>();
// Valid only if Bar has a setter (of course, otherwise it wouldn't compile)
foo.Bar = new Bar();
// Valid only if Bar does not have a setter (less obvious, as this will compile)
foo.Stub(x => x.Bar).Return(new Bar());
处理这些问题确实很麻烦,尤其是在进行重构时。
所以我的问题是,任何人都可以想出一种自定义 Resharper/Visual Studio 快捷方式的好方法,让我可以快速从一个转换到另一个吗?
【问题讨论】:
标签: visual-studio resharper rhino-mocks