GetLogger() 공개 메소드

Creates the Appropriate IHabaneroLogger based on the LoggerFactory you have implemented. See IHabaneroLoggerFactory.GetLogger(string) form more details
public GetLogger ( Type contextType ) : IHabaneroLogger
contextType System.Type The Type of BO this log is for
리턴 IHabaneroLogger
        public void Test_GetLogger_WithContextname_ShouldReturnNewLoggerWithContextName()
        {
            //---------------Set up test pack-------------------
            IHabaneroLoggerFactory loggerFactory = new Log4NetLoggerFactory();
            string expectedContextName = TestUtil.GetRandomString();
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            var logger = loggerFactory.GetLogger(expectedContextName);
            //---------------Test Result -----------------------
            Assert.AreEqual(expectedContextName, logger.ContextName);
        }
        public void Test_GetLogger_WithType_ShouldCreateLog4NetLogger()
        {
            //---------------Set up test pack-------------------
            IHabaneroLoggerFactory loggerFactory = new Log4NetLoggerFactory();
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            var logger = loggerFactory.GetLogger(typeof(FakeObject));
            //---------------Test Result -----------------------
            Assert.IsNotNull(logger);
            Assert.IsInstanceOf<Log4NetLogger>(logger);
        }
        public void Test_GetLogger_ShouldReturnNewLogger()
        {
            //---------------Set up test pack-------------------
            IHabaneroLoggerFactory loggerFactory = new Log4NetLoggerFactory();
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            var logger = loggerFactory.GetLogger(TestUtil.GetRandomString());
            //---------------Test Result -----------------------
            Assert.IsNotNull(logger);
            Assert.IsInstanceOf<IHabaneroLogger>(logger );
            Assert.IsInstanceOf<Log4NetLogger>(logger);
        } 
        public void Test_GetLogger_WithType_ShouldSetContext()
        {
            //---------------Set up test pack-------------------
            IHabaneroLoggerFactory loggerFactory = new Log4NetLoggerFactory();
            const string expectedContextName = "Habanero.Test.Base.Logging.FakeObject";
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            var logger = loggerFactory.GetLogger(typeof(FakeObject));
            //---------------Test Result -----------------------
            Assert.AreEqual(expectedContextName, logger.ContextName);
        }