Think it’s necessary to mock ILogger?

by Aug 25, 2023

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?


Subscribe to
The Daily Friction

A daily newsletter on automation and eliminating friction

Related Content

Improving Optimization?

Improving Optimization? The traditional steps of Optimization: 1. Eliminate 2. Automate or 3. Delegate What if we added a missing element? Simplify. Before automating a convoluted workflow or delegating a tangled task, strip away the unnecessary. Make processes leaner...

read more

Unit tests for Dataverse plugins?

Unit tests for Dataverse plugins? I must admit, I almost never write unit tests for Dataverse plugins. Plugins are often quite simple, testing them in isolation is not particularly useful. Often you only test a couple of if-statements. Unit tests don't bring a lot of...

read more

New Dynamics 365 browser extension

New Dynamics 365 browser extension I'm trying out the new -Power Roles- extension and it looks very promising. You browse to a Dynamics 365 (or Power Apps) app and then you press -record-. It will then monitor all the action you do in the app and propose which...

read more