public void TestLogException() { // arrange var loggerMock = LoggerUtils.LoggerMock <MyHandler>(); var handler = new MyHandler(loggerMock.Object); var expected = "Hello exception"; // act var exception = Assert.Throws <Exception>(() => handler.LogException(expected)); // assert loggerMock.VerifyLog(LogLevel.Error, expected); }
public void TestLogWarning() { // arrange var loggerMock = LoggerUtils.LoggerMock <MyHandler>(); var handler = new MyHandler(loggerMock.Object); var expected = "Hello warning"; // act handler.LogWarning(expected); // assert loggerMock.VerifyLog(LogLevel.Warning, expected); }
public void TestLogError() { // arrange var loggerMock = LoggerUtils.LoggerMock <MyHandler>(); var handler = new MyHandler(loggerMock.Object); var expected = "Hello error"; // act handler.LogError(expected); // assert loggerMock.VerifyLog(LogLevel.Error, expected); }
public void TestLogInformation() { // arrange var loggerMock = LoggerUtils.LoggerMock <MyHandler>(); var handler = new MyHandler(loggerMock.Object); var expected = "Hello information"; // act handler.LogInformation(expected); // assert loggerMock.VerifyLog(LogLevel.Information, expected); }