public void test_dynamologger_logger() { //Arrange //This has been done in the base class but we need to do it again because the pathManager is private var config = CreateStartConfiguration(dynamoSettings); pathManager = new PathManager(new PathManagerParams { CorePath = config.DynamoCorePath, HostPath = config.DynamoHostPath, PathResolver = config.PathResolver }); // Ensure we have all directories in place. var exceptions = new List <Exception>(); pathManager.EnsureDirectoryExistence(exceptions); //By setting the VerboseLogging we will enable a piece of code inside the method:: //private void Log(string message, LogLevel level, bool reportModification) var debugSettings = new DebugSettings { VerboseLogging = true }; var logger = new DynamoLogger(debugSettings, pathManager.LogDirectory); //Act logger.LogWarning("Testing Logging Warning", WarningLevel.Error); Assert.AreEqual(logger.WarningLevel, WarningLevel.Error); Assert.AreEqual(logger.Warning, "Testing Logging Warning"); logger.ResetWarning(); logger.LogInfo("Testing Logging Warning", "info test"); logger.LogError("Testing Logging Error", "Error Details"); //Assert //Check if the logged info was inserted inside the logged text (the log file cannot be opened due that is being used by the base class) Assert.IsTrue(logger.LogText.Contains("Testing Logging Warning")); logger.Dispose(); logger.Dispose();//Calling a second time this function will enter in a validation not covered }
public void test_dynamologger_logger() { // Get the dynamo logger in non-test mode, as we write the logs // to dynamo console and to a file only in non-test mode. logger = GetDynamoLoggerWithTestModeFalse(); //Act logger.LogWarning("Testing Logging Warning", WarningLevel.Error); Assert.AreEqual(logger.WarningLevel, WarningLevel.Error); Assert.AreEqual(logger.Warning, "Testing Logging Warning"); logger.ResetWarning(); logger.LogInfo("Testing Logging Warning", "info test"); logger.LogError("Testing Logging Error", "Error Details"); //Assert //Check if the logged info is stored in the LogText property (the log file cannot be opened due that is being used by the base class) Assert.IsTrue(logger.LogText.Contains("Testing Logging Warning")); logger.Dispose(); logger.Dispose();//Calling a second time this function will enter in a validation not covered }