The Replay error on AAA was obviously due to me not swapping out from
my mock repository to the static factory MockRepository.GenerateMock
(), so that's resolved. AAA works.

Still, I'd like to be able to generate dynamic vs strict mocks, and
use the repository's record/replay semantics, except it keeps giving
me that tostring() error when in debug on: mockObject.Replay()

No big deal if not, I can work around for now.

On Jul 16, 9:48 am, Hudson Akridge <[email protected]> wrote:
> AAA gives me the following error: Cannot assert on an object that is
> not in replay mode. Did you forget to call ReplayAll()
>
> Here's my test attempting to do this outside of the test fixture (to
> attempt to eliminate complexities:
>
>             var mocks = new MockRepository();
>             var entity = mocks.Stub<AttributeValueEntityBase>();
>             var attribute = mocks.Stub<Attribute>();
>             var value = Factory.AttributeValueFactory
> (AttributeValueType.Text);
>
>             entity.Expect(x => x.RemoveAttributeValue
> (value)).Repeat.Once();
>             value.Owner = entity;
>
>             attribute.Expect(x => x.RemoveAttributeValue
> (value)).Repeat.Once();
>             value.Attribute = attribute;
>
>             value.Dereference(); //Should and does call both removes
> for the Owner and Attribute properties on value
>
>             entity.AssertWasCalled(x => x.RemoveAttributeValue
> (value)); //Fails here
>             attribute.AssertWasCalled(x => x.RemoveAttributeValue
> (value));
>
> I started off using AAA and was receiving this error, so assumed I
> needed to be using a record/replay model.
>
> Regarding the main error of the thread with debugging, I still get the
> original ToString() error on the .Dereference() call with the above
> code if I'm stepping through it in debug.
>
> On Jul 15, 9:26 pm, Kenneth Xu <[email protected]> wrote:
>
>
>
> > Could characteristic a type you actually mean mockAttribute instead?
> > If that is not the case, would you be able to isolate the issue in a
> > small reproducable sample?
>
> > On Wed, Jul 15, 2009 at 6:07 PM, Hudson Akridge<[email protected]> wrote:
> > >            Expect.Call(() => mockAttribute.RemoveValue
> > > (Value)).Repeat.AtLeastOnce();
> > >            characteristic.Replay();
--~--~---------~--~----~------------~-------~--~----~
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