Mar*_*909 4 .net c# rhino-mocks
假设我有一个具有只读属性的Concrete类,例如
public class TestClass
{
public bool Squid {get;private set;}
}
Run Code Online (Sandbox Code Playgroud)
现在我想把对Squid的响应存根
Squid squid = MockRepository.GenerateStub<Squid>();
squid.Stub(c => c.Squid).Return(true);
Run Code Online (Sandbox Code Playgroud)
但是当我运行它时,我收到以下错误消息:System.InvalidOperationException:无效的调用,已使用最后一次调用或未进行任何调用(确保您正在调用虚拟(C#)/可覆盖(VB)方法) .
有没有办法在没有为类创建接口的情况下对此属性进行存根?
| 归档时间: |
|
| 查看次数: |
1357 次 |
| 最近记录: |