But that should be fixed with recursive mocks. On Fri, Sep 11, 2009 at 1:05 AM, Tim Barcz <[email protected]> wrote:
> You need to set up an object for the "Identity" object. > > right now, x.Identity is null, so a call to x.Identity.Name is of course > Null > > On Thu, Sep 10, 2009 at 2:38 PM, kurtharriger <[email protected]>wrote: > >> >> >> I was trying to use the recursive mock syntax and kept getting >> NullReferenceException error. >> Here is a failing test - same as CanUseRecursiveMockSimpler() but >> using Stub instead. >> >> [Test] >> public void CanUseRecursiveStubSimpler() >> { >> var mockService = MockRepository.GenerateStub<IMyService> >> (); >> >> mockService.Expect(x => x.Identity.Name).Return("foo"); >> >> Assert.AreEqual("foo", mockService.Identity.Name); >> } >> >> >> >> >> > > > -- > Tim Barcz > 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 -~----------~----~----~----~------~----~------~--~---
