Myea... This was an *AU* moment. I (finally) find the solution to my
problem. I feel stupid :)

The GetDataCount method of the XmlQueryListReader overrides an
abstract method. Rhino mocks is able to mock that.
The GetOwnerID method of XmlDataProvider _was_ implementing a method
of it's interface (IDataProvider). Since I mock the XmlDataProvider
and not the IDataProvider, rhino mocks is not able to mock a method
call to GetOwnerID. Makes sense. So I made GetOwnerID virtual et
voila...

TweeZz == mock newb :)

Manu aka TweeZz.

On Dec 1, 10:07 pm, TweeZz <[EMAIL PROTECTED]>
wrote:
> Hi,
>
> I have some kind of 'global test setup' method. One of the things it
> does is this:
>             Mocks = new MockRepository();
>             NuntioFactory = Mocks.Stub<INuntioFactory>();
>             ...
>             DataProvider = Mocks.PartialMock<XmlDataProvider>();
>             ...
>             ...
>             SetupResult.For(NuntioFactory.DataProvider).Return
> (DataProvider);
>
> Then in the actual test method I have:
>             IListReader queryListReader =
> Mocks.PartialMock<XmlQueryListReader>(NuntioFactory);
>             SetupResult.For(queryListReader.GetDataCount(null)).Return
> (2).IgnoreArguments();
>             ...
>             ...
>             SetupResult.For(DataProvider.GetOwnerID(null)).Return
> (111).IgnoreArguments();
>
> The test throws an exception on the line where I try to setup a result
> for the GetOwnerID method call.
>
> What I don't understand is the following: Why am I able to create a
> partial mock of my XmlQueryListReader and setup a result for a method
> without having the method being actually executed. And why am I not
> able to do that for my XmlDataProvider mock?
>
> I must be missing something? As far as I see it (probably not far
> enough ;)) I'm using 2 times the same principle. One time it does what
> I expect it to do and one time it doesn't.
> Could someone please point me in the good direction?
>
> Thank you...
> Manu aka TweeZz.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Rhino.Mocks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/RhinoMocks?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to