I have a component that uses log4net. I want to create unit tests, that validate that certain error conditions result in the correct logging.
I was thinking that the best way to do this is to create an ILogAppender implementation, for example a mock. I would then add the log appender to log4net during test setup, inspect what was written during test validation, and remove it again during test teardown.
Is this possible?
See Question&Answers more detail:os