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();
精彩评论