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 Steele http://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=.
