Question

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 SaveObject(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?

Was it helpful?

Solution

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();

OTHER TIPS

Have you try this

Expect.On(this.mockDal).Call(this.mockDal.SaveObject((object)entry)).IgnoreArguments();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top