public void ShouldNotWriteMessageIfWarningVerbosity() { // Arrange const LogType verbosity = LogType.Warning; const string message = "Test Message"; // Act var logger = new ConsoleLogger(verbosity); var loggedMessage = logger.LogMessage(message); // Assert Assert.AreEqual(null, loggedMessage); }
public void ShouldNotLogIfMessageWhitespace() { // Act var logger = new ConsoleLogger(LogType.Message); logger.LogMessage(" "); // Spaces and tabs }
public void ShouldNotLogIfMessageNull() { // Act var logger = new ConsoleLogger(LogType.Message); logger.LogMessage(null); }
public void ShouldNotLogIfMessageEmpty() { // Act var logger = new ConsoleLogger(LogType.Message); logger.LogMessage(string.Empty); }
public void ShouldWriteMessageIfMessageVerbosity() { // Arrange const LogType verbosity = LogType.Message; const string message = "Test Message"; var consoleWrapperMock = new Mock<IConsoleWrapper>(MockBehavior.Strict); consoleWrapperMock.Setup(c => c.SetMessageForegroundColor()).Verifiable(); consoleWrapperMock.Setup(c => c.WriteLine("{0} {1}", new object[] { It.IsAny<string>(), message })).Verifiable(); consoleWrapperMock.Setup(c => c.ResetColor()).Verifiable(); // Act var logger = new ConsoleLogger(verbosity, consoleWrapperMock.Object); var loggedMessage = logger.LogMessage(message); // Assert consoleWrapperMock.VerifyAll(); Assert.AreEqual(message, loggedMessage); }