public void ShouldNotWriteWarningIfErrorVerbosity() { // Arrange const LogType verbosity = LogType.Error; const string message = "Test Message"; // Act var logger = new ConsoleLogger(verbosity); var loggedMessage = logger.LogWarning(message); // Assert Assert.AreEqual(null, loggedMessage); }
public void ShouldWriteWarningIfWarningVerbosity() { // Arrange const LogType verbosity = LogType.Warning; const string message = "Test Message"; var consoleWrapperMock = new Mock<IConsoleWrapper>(MockBehavior.Strict); consoleWrapperMock.Setup(c => c.SetWarningForegroundColor()).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.LogWarning(message); // Assert consoleWrapperMock.VerifyAll(); Assert.AreEqual(message, loggedMessage); }