static void Main(string[] args) { //Initialize Logger at startup var loggingInstance = EntLogger.Initialize(); var logger = new LoggerTest(); logger.Logit(loggingInstance); }
public void TestLoggerApplicationNameIsSetAfterInitialize() { // Arrange var loggingInstance = EntLogger.Initialize(); // Act var appName = GlobalContext.Properties["ApplicationName"]; // Assert Assert.AreEqual("EnterpriseLogger.EntLogger", appName); //Display TestContextInstance.WriteLine("ApplicationName = " + appName); }
public void TestLoggerNameIsSetAfterInitialize() { // Arrange var loggingInstance = EntLogger.Initialize(); // Act var name = loggingInstance.Logger.Name; // Assert Assert.AreEqual("EnterpriseLogger.EntLogger", name); //Display TestContextInstance.WriteLine("Logger.Name = " + name); }
public void TestLoggerCorrelationIdIsSetAFterInitialize() { // Arrange var loggingInstance = EntLogger.Initialize(); // Act var corrId = GlobalContext.Properties["CorrelationId"]; // Assert Assert.IsNotNull(corrId); Assert.IsTrue(corrId.GetType() == typeof(Guid)); //Display TestContextInstance.WriteLine("CorrelationId = " + corrId); }
public void LogDebugGeneratesLoggingEvent() { //Helper class removes configured appender and replaces it with a memory appender //Allows unit test to generate and test that a log4net message was created (in memory) // Arrange var loggingInstance = EntLogger.Initialize(); // Act var loggingEvents = LogInstanceMethodHelper(loggingInstance, "Test LogDebug Method"); // Assert if (loggingEvents == null) { Assert.Fail("LoggingEvents is null"); } foreach (var loggingEvent in loggingEvents) { Assert.AreEqual("Test LogDebug Method", loggingEvent.RenderedMessage); //Display TestContextInstance.WriteLine("RenderedMessage = " + loggingEvent.RenderedMessage); } }