public void ShouldNotWriteWarningIfErrorVerbosity() { // Arrange const LogType verbosity = LogType.Error; const string message = "Test Message"; // Act var logger = new TextFileLogger(verbosity); var loggedMessage = logger.LogWarning(message); // Assert Assert.AreEqual(null, loggedMessage); }
public void ShouldWriteErrorIfErrorVerbosity() { // Arrange const LogType verbosity = LogType.Error; const string message = "Test Message"; var fileWrapperMock = new Mock<IFileWrapper>(MockBehavior.Strict); fileWrapperMock.Setup(c => c.AppendAllText(It.Is<string>(path => path.Contains(this.logFilePath)), message)).Verifiable(); // Act var logger = new TextFileLogger(verbosity, fileWrapperMock.Object); var loggedMessage = logger.LogError(message); // Assert fileWrapperMock.VerifyAll(); Assert.AreEqual(message, loggedMessage); }