【发布时间】:2010-07-15 20:15:15
【问题描述】:
我在使用 Rhino Mocks 时遇到了另一个有趣的问题。谁能回答这个问题:
这是我在代码中进行的调用:
Expect.On(this.mockDal).Call(this.mockDal.SaveObject(entry)).IgnoreArguments();
mockDal 正在模拟 Dal 类型的东西,它的 SaveObject 方法的签名是这样的;
void SaveObject(object obj);
Visual Studio,在我的代码的第一部分(即不是 IgnoreArguments 的部分)给了我这个非常令人困惑的错误:
Error 1 The type arguments for method 'Rhino.Mocks.Interfaces.ICreateMethodExpectation.Call<T>(T)' cannot be inferred from the usage. Try specifying the type arguments explicitly.
我已经尝试过使用 var 类型的条目及其实际类型(称为 SpaceViewEntry),但每次都给我同样的错误。有什么想法吗?
【问题讨论】:
标签: c# visual-studio-2010 rhino-mocks rhino rhino-mocks-3.5