Use SetupResult instead of Expect
Make sure to call ReplayAll

On Tue, Feb 3, 2009 at 10:02 PM, jschank <[email protected]> wrote:

>
> Hello,
> I'm trying to use Rhino Mocks to mock a complicated object. I know
> that the method I'm testing only calls a couple of methods on my
> object. So I want to stub or mock certain behavior on my mock.
>
> The problem is this:
>
> Given this expectation:
>            Expect.Call(m_MockBond.CB_IOTYPE).Return
> (Enumerations.IOType.IO_Cash);
>
> m_MockBond.CB_IOTYPE gets called as part of setting up the
> expectation, in this case, the object isn't fully initialized, and the
> m_MockBond.CB_IOTYPE throws an exception.
>
> m_MockBond was created from from a class (not an interface), I've
> tried DynamicMock, StrictMock and PartialMock, nothing works.
>
> I don't want to have to fully initialize my bond, and I want to just
> force CB_IOTYPE to return a specific value. But I can't because of the
> exception.
>
> How am I supposed to do this?
>
> Thanks,
> John Schank
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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