Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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

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

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