How can you assert that some code generates a log message?
Like this:

 TestHelper.AssertLogMessageIsGenerated(() =>
                                                       {
                                                           Log.Debug("Hello");
                                                       }, "Hello");

The first argument of the method is an Action. The second part is the expected message. The testhelper executes the action and verifies the logmessage was found.

  • No labels