When writing unit tests in .NET, you may need to verify that methods are logging exceptions, errors, or other key information. You might think, No problem, I'll just mock ILogger using my favourite mocking library – for example Moq, NSubstitute, or FakeItEasy. While ILogger itself is an interface and can be mocked, many of its commonly used logging methods (like LogInformation(), LogError(), and so on) are what’s called static or extension methods.
Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile