thanks a lot Patrick - that's exactly what i was looking for (for too
much time) !!!

Tom

On Nov 23, 6:12 pm, Patrick Steele <[email protected]> wrote:
> Oops.  Okay.  I see.  Something like this should work:
>
>                         ILog log = MockRepository.GenerateStub<ILog>();
>                         ILogger logger = 
> MockRepository.GenerateStub<ILogger>();
>                         logger.Stub(l => 
> l.IsEnabledFor(Level.FATAL)).Return(true);
>                         log.Stub(l => l.Logger).Return(logger);
>
> ---
> Patrick Steelehttp://weblogs.asp.net/psteele
>
> On Mon, Nov 23, 2009 at 10:58 AM, tom308 <[email protected]> wrote:
> > sorry if i was misunderstood.
> > i don't need the static call - i have a ILog instance and i want to
> > mock the <ILog instance>.Logger.IsEnabledFor().
>
> > Thanks
> > Tom
>
> > On Nov 23, 5:48 pm, Patrick Steele <[email protected]> wrote:
> >> LogManager.GetLogger() is static and therefore can't be intercepted by
> >> Rhino Mocks.  You may want to consider wrapping the functionality of
> >> your logging in your own interfaces.  You can mock out those
> >> interfaces during testing, and implement a log4net implementation of
> >> those interfaces for runtime.
>
> >> ---
> >> Patrick Steelehttp://weblogs.asp.net/psteele
>
> >> On Mon, Nov 23, 2009 at 8:46 AM, tom308 <[email protected]> wrote:
> >> > Hi all!
> >> > i found few solution to this issue that didn't solve my problem.
> >> > i am building a log4net wrapper,  and i am testing it with MSTest &
> >> > Rhino mock 3.5.
>
> >> > my problem is that i am trying to mock the LogManager.GetLogger
> >> > ().Logger.IsEnabledFor().
> >> > i get object reference exception when trying to do:
>
> >> > rootLogger.Stub(l => l.Logger.IsEnabledFor(Level.Fatal)).Return(true);
>
> >> > and i can't do something like this:
>
> >> > rootLogger.Logger = new RootLogger();
>
> >> > because Logger is readOnly.
>
> >> > can anyone help?

--

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