public void UsesSpecifiedObjectRendererForType() { var testLogger = new TestLogger(LogLevel.Debug); var mockRenderer = MockRepository.GenerateMock<IObjectRenderer>(); testLogger.AddObjectRenderer<string>(mockRenderer); testLogger.Debug("Test {0}", "Test"); mockRenderer.AssertWasCalled(p => p.Render("Test")); }
public void WalksTheClassHierarchyUpwardsIfNoRenderersAreFound() { var testLogger = new TestLogger(LogLevel.Debug); var mockRenderer = MockRepository.GenerateMock<IObjectRenderer>(); testLogger.AddObjectRenderer<ObjectRendering>(mockRenderer); var childClassOfChildClass = new SubTestClass(); testLogger.Debug("Test {0}", childClassOfChildClass); mockRenderer.AssertWasCalled(p => p.Render(childClassOfChildClass)); }
public void UsesRendererOfBaseClassIfPossible() { var testLogger = new TestLogger(LogLevel.Debug); var mockRenderer = MockRepository.GenerateMock<IObjectRenderer>(); testLogger.AddObjectRenderer<ObjectRendering>(mockRenderer); var testChildClass = new TestChildClass(); testLogger.Debug("Test {0}", testChildClass); mockRenderer.AssertWasCalled(p => p.Render(testChildClass)); }