A blog by Davide Bellone

Latest articles

3 ways to inject DateTime and test it

DateTime, Guid, and Random values are not under your direct control. You should abstract them to write better code and testing. We'll see 3 ways to inject and test them in .NET Core projects

2021-Jan-127 Min Read

How to view code coverage with Coverlet and Visual Studio 2019

Code coverage is an indicator of the quality of your code. With Coverlet and VS2019 you can have a human readable report to see where to improve your code.

2020-Dec-294 Min Read

Clean code tips - Error handling

The way you handle errors on your code can have a huge impact on the maintainability of your projects. Don't underestimate the power of clean error handling.

2020-Dec-1512 Min Read

How to use String.Format - and why you should care about it

Is string.Format obsolete? Not at all, it still has cards to play! Let's see how we can customize format and create custom formatters.

How to Ping an endpoint with C#

How to effectively ping an endpoint in C#? Don't use the HttpClient, when .NET provides a Ping class to perform all these operations.

How to integrate MongoDB with C#

MongoDB is a database based on JSON-like documents, but it can be queried using C#. We'll see how to perform CRUD operations and we'll create some advanced queries.