public void AddMessage_WithErrorMessageTypeAndNullMessage_ShouldThrownLoggerDatabaseException() { // Arrange ILogger databaseLogger = LoggerFactory.InitializeFactory().CreateLogger(LoggerTypes.Database); // Act databaseLogger.AddMessage(MessageTypes.Error, null); // Assert // Expected LoggerDatabaseException }
public void AddMessage_WithWarningMessageTypeAndSomeMessage_ShouldAddLog() { // Arrange ILogger fileLogger = LoggerFactory.InitializeFactory().CreateLogger(LoggerTypes.File); // Act fileLogger.AddMessage(MessageTypes.Warning, "Warning Message"); // Assert Assert.IsTrue(true); }
public void AddMessage_WithWarningMessageTypeAndEmptyMessage_ShouldThrownLoggerDatabaseException() { // Arrange ILogger databaseLogger = LoggerFactory.InitializeFactory().CreateLogger(LoggerTypes.Database); // Act databaseLogger.AddMessage(MessageTypes.Warning, ""); // Assert // Expected LoggerDatabaseException }
public void AddMessage_WithWarningMessageTypeAndNullMessage_ShouldThrownLoggerFileException() { // Arrange ILogger fileLogger = LoggerFactory.InitializeFactory().CreateLogger(LoggerTypes.File); // Act fileLogger.AddMessage(MessageTypes.Warning, null); // Assert // Expected LoggerFileException }
public void AddMessage_WithInformationMessageTypeAndEmptyMessage_ShouldThrownLoggerFileException() { // Arrange ILogger fileLogger = LoggerFactory.InitializeFactory().CreateLogger(LoggerTypes.File); // Act fileLogger.AddMessage(MessageTypes.Information, ""); // Assert // Expected LoggerFileException }
public void AddMessage_WithErrorMessageTypeAndEmptyMessage_ShouldThrownLoggerConsoleException() { // Arrange ILogger consoleLogger = LoggerFactory.InitializeFactory().CreateLogger(LoggerTypes.Console); // Act consoleLogger.AddMessage(MessageTypes.Error, ""); // Assert // Expected LoggerConsoleException }
public void AddMessage_WithInformationMessageTypeAndSomeMessage_ShouldAddLog() { // Arrange ILogger consoleLogger = LoggerFactory.InitializeFactory().CreateLogger(LoggerTypes.Console); // Act consoleLogger.AddMessage(MessageTypes.Information, "Information Message"); // Assert Assert.IsTrue(true); }
public void AddMessage_WithInformationMessageTypeAndNullMessage_ShouldThrownLoggerConsoleException() { // Arrange ILogger consoleLogger = LoggerFactory.InitializeFactory().CreateLogger(LoggerTypes.Console); // Act consoleLogger.AddMessage(MessageTypes.Information, null); // Assert // Expected LoggerConsoleException }
public static void Main(string[] args) { try { ILogger consoleLogger = LoggerFactory.InitializeFactory().CreateLogger(LoggerTypes.Console); consoleLogger.AddMessage(MessageTypes.Information, "Message Information"); consoleLogger.AddMessage(MessageTypes.Warning, "Message Warning"); consoleLogger.AddMessage(MessageTypes.Error, "Message Error"); } catch (LoggerConsoleException ex) { Console.WriteLine(ex.Message); } try { ILogger fileLogger = LoggerFactory.InitializeFactory().CreateLogger(LoggerTypes.File); fileLogger.AddMessage(MessageTypes.Information, "Message Information"); fileLogger.AddMessage(MessageTypes.Warning, "Message Warning"); fileLogger.AddMessage(MessageTypes.Error, "Message Error"); } catch (LoggerFileException ex) { Console.WriteLine(ex.Message); } try { ILogger databaseLogger = LoggerFactory.InitializeFactory().CreateLogger(LoggerTypes.Database); databaseLogger.AddMessage(MessageTypes.Information, "Message Information"); databaseLogger.AddMessage(MessageTypes.Warning, "Message Warning"); databaseLogger.AddMessage(MessageTypes.Error, "Message Error"); } catch (LoggerDatabaseException ex) { Console.WriteLine(ex.Message); } Console.ReadKey(); }
/// <summary> /// Writes a string to the text stream. /// </summary> /// <param name="value">The string to write.</param> /// <exception cref="T:System.ObjectDisposedException"> /// The <see cref="T:System.IO.TextWriter"/> is closed. /// </exception> /// <exception cref="T:System.IO.IOException"> /// An I/O error occurs. /// </exception> public override void Write(string value) { _logger.AddMessage(_severity, value); }