コード例 #1
0
        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"));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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));
        }