public Logger(String logName, IConfigurationNlog configuration) { var name = String.IsNullOrEmpty(logName) ? DateTime.Now.ToShortDateString() : logName; _logger = LogManager.GetCurrentClassLogger(); LogManager.Configuration = configuration.GetLogConfiguration(name); }
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")); }