예제 #1
0
		public void Debug_LogMessageWithException_ExceptionLogged() {
			var memoryAppender = GetMemoryAppender("${exception}");
			var log4netManagerAdapter = new LogManagerAdapter();
			var logger = log4netManagerAdapter.GetCurrentClassLogger();

			logger.Debug("Any message", new Exception("Any exception message"));

			Assert.AreEqual("Any exception message", memoryAppender.Logs[0]);
		}
예제 #2
0
		public void Debug_LogMessage_MessageLevelSetToDebug() {
			var memoryAppender = GetMemoryAppender("${level}");
			var log4netManagerAdapter = new LogManagerAdapter();
			var logger = log4netManagerAdapter.GetCurrentClassLogger();

			logger.Debug("Any message");

			Assert.AreEqual("Debug", memoryAppender.Logs[0]);
		}
예제 #3
0
		public void Debug_LogMessageToCurrentClassAdapter_MessageWrittenCurrentClassLogger() {
			var memoryAppender = GetMemoryAppender("${logger}");
			var log4netManagerAdapter = new LogManagerAdapter();
			var logger = log4netManagerAdapter.GetCurrentClassLogger();

			logger.Debug("Any message");

			Assert.AreEqual(typeof(LogManagerAdapterTests).FullName, memoryAppender.Logs[0]);
		}
예제 #4
0
		public void Debug_LogMessage_MessageWrittenToAdapter() {
			var memoryAppender = GetMemoryAppender("${message}");
			var log4netManagerAdapter = new LogManagerAdapter();
			var logger = log4netManagerAdapter.GetCurrentClassLogger();

			logger.Debug("Any message");

			Assert.AreEqual("Any message", memoryAppender.Logs[0]);
		}
예제 #5
0
		public void DebugFormat_LogMessageWithFormatProviderAndDateAndTellToFormatAsIso_DateFormatAfterIsoStandard() {
			var memoryAppender = GetMemoryAppender("${message}");
			var log4netManagerAdapter = new LogManagerAdapter();
			var logger = log4netManagerAdapter.GetCurrentClassLogger();

			var date = new DateTime(2000, 1, 1);
			logger.DebugFormat(CultureInfo.InvariantCulture, "{0:s}", date);

			Assert.AreEqual("2000-01-01T00:00:00", memoryAppender.Logs[0]);
		}
예제 #6
0
		public void IsFatalEnabled_CreateAdapterWhereFatalIsEnabled_ReturnsTrue() {
			GetMemoryAppender("${message}", LogLevel.Fatal);
			var log4netManagerAdapter = new LogManagerAdapter();
			var logger = log4netManagerAdapter.GetCurrentClassLogger();

			Assert.IsTrue(logger.IsFatalEnabled);
		}