public void ShouldNotWriteWarningIfErrorVerbosity() { // Arrange const LogType verbosity = LogType.Error; const string message = "Test Message"; // Act var logger = new SqlDatabaseLogger(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 logsRepositoryMock = new Mock<ILogsRepository>(MockBehavior.Strict); logsRepositoryMock.Setup(c => c.AddLogValue(It.Is<LogValue>(lv => lv.Message.Contains(message) && lv.Type == LogType.Warning))).Returns(It.IsAny<LogValue>).Verifiable(); // Act var logger = new SqlDatabaseLogger(verbosity, logsRepositoryMock.Object); var loggedMessage = logger.LogWarning(message); // Assert logsRepositoryMock.VerifyAll(); Assert.AreEqual(message, loggedMessage); }