开发者

Rhino Mocks and Visual Studio: How do I fix this error?

I'm having another fun problem with Rhino Mocks. Can anyone answer this one:

Here's the call that I'm making in my code:

Expect.On(this.mockDal).Call(this.mockDal.SaveObject(entry)).IgnoreArguments();

mockDal is mocking something of type Dal, and it's SaveObject method's signature is this;

void SaveO开发者_StackOverflow社区bject(object obj);

Visual Studio, on the first part of my code (i.e. not the part with IgnoreArguments) is giving me this wonderfully confusing error:

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.

I've tried this with entry being of type var and its actual type (called SpaceViewEntry), and it gives me the same error each time. Any ideas?


If you just want to set up an expectation that the SaveObject will be called, using the new AAA syntax might be easier:

this.mockDal.Expect(m => m.SaveObject(entry)).IgnoreArguments();


Have you try this

Expect.On(this.mockDal).Call(this.mockDal.SaveObject((object)entry)).IgnoreArguments();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜