Пример #1
0
		public void Error()
		{
			// arrange
			var logger = new Logger();
			var logs = new StringBuilder();
			logger.SetWriter(new StringWriter(logs));
			logger.AddCategory("error");

			// act
			logger.Debug("debug message");
			logger.Info("info message");
			logger.Error("error message");

			// assert
			Assert.Equal("error message", logs.ToString().Trim());
		}
Пример #2
0
 private Logger GetLogger()
 {
     _loggerOutput = new StringBuilder();
     var writer = new StringWriter(_loggerOutput);
     var logger = new Logger();
     logger.SetWriter(writer);
     logger.AddCategory("info");
     logger.AddCategory("error");
     return logger;
 }