the failing erratically sounds like a shared state problem (are you using
statics in your app?).

On Mon, Jun 28, 2010 at 10:30 AM, Adam <[email protected]> wrote:

> Hi.  If I have the following:
>
> DataLayer.IAccrualRepository repo =
> MockRepository.GenerateMock<DataLayer.IAccrualRepository>();
> repo.Expect(r => r.Invoices).Return( MockRepository.GenerateMock<
> System.Data.Objects.IObjectSet< DataLayer.Invoice>>());
>
> Does anyone know why the following two lines produce such different
> results:
>
>            Pres.Repository.Invoices.AssertWasCalled(i =>
> i.AddObject(Arg<DataLayer.Invoice>.Is.Anything), s =>
> s.Repeat.Twice());
>            Pres.Repository.AssertWasCalled(r =>
> r.Invoices.AddObject(Arg<DataLayer.Invoice>.Is.Anything), s =>
> s.Repeat.Twice());
>
> Just in general saying Repo.Invoice.AssertWasCalled (   ....  seems to
> work as expected, but Repo.AssertWasCalled (r => r.Invoices....
> behaves erratically - sometimes failing when it should pass, and
> sometimes passing when it should fail?  Obviously I'll just use the
> first way, but I was hoping someone could help me to understand why?
>
> Thanks!
>
> --
> 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]<rhinomocks%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/rhinomocks?hl=en.
>
>


-- 
Tim Barcz
Microsoft C# MVP
Microsoft ASPInsider
http://timbarcz.devlicio.us
http://www.twitter.com/timbarcz

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