예제 #1
0
        public Logger(String logName, IConfigurationNlog configuration)
        {
            var name = String.IsNullOrEmpty(logName) ? DateTime.Now.ToShortDateString() : logName;

            _logger = LogManager.GetCurrentClassLogger();
            LogManager.Configuration = configuration.GetLogConfiguration(name);
        }
예제 #2
0
        public void NlogConfigTest()
        {
            //Arrange
            var mock = new Mock <IConfigurationNlog>();

            //Act
            mock.Setup(x => x.GetLogConfiguration("LogName")).Returns(new LoggingConfiguration());

            //Assert
            IConfigurationNlog conf = mock.Object;
            var nConf = conf.GetLogConfiguration("LogName");

            Assert.AreEqual(nConf, mock.Object.GetLogConfiguration("LogName"));
        }