Think it’s necessary to mock ILogger?

by Remy van Duijkeren | Aug 25, 2023 | Shorts

Think it's necessary to mock ILogger?

Using Moq or NSubstitute to do this? Think again.

In the C# world, many developers do this - but there's a more efficient way.

Enter NullLogger.

NullLogger, a minimalist logger from Microsoft, lets you fulfill your dependency without any fuss. All while doing... well, nothing.

Creating an instance? It's as simple as 'NullLogger.Instance'.

Give it a try next time you're coding. You might just find it changes your approach completely.

So, who's ready to ditch the old method and embrace NullLogger?

Related