Adding test description for data-driven tests in xUnit
Often times, you find yourself in writing data-driven tests in xUnit (like Theory
tests) and you want to add a description to each test case. Let's explore how to do that.
Hey, I'm Steven a .NET Developer in Switzerland. I am a Microsoft MVP. Also, this blog is open source on GitHub.
Often times, you find yourself in writing data-driven tests in xUnit (like Theory
tests) and you want to add a description to each test case. Let's explore how to do that.
Did you ever try to have a switch expression in Blazor? Yes, and did it go well? Sometimes not. Let's see why!
As every year, the dotnet team adjusted the runtime and libraries to improve performance. So let's go over some of the highlights. I will link the corresponding blog post or GitHub issue for each item, so you can read more about it if you are interested.
And of course: You will find the benchmarks at the end of the article.
If you want to be up to date with dotnet development, you can obviously follow the official blogs from Microsoft and release notes. But what if you want to pick into the future or smaller details that aren't released or covered? Then let's go to GitHub!
If we have a List<T>
and an IList<T>
, enumerating over the List<T>
is faster than enumerating over the IList<T>
. Why is that?
For good reasons, many folks don't want to use reflection. Since .NET 8, we have a better way of dealing with this in most of the cases (when known in advance). But we can go the opposite: Make it even unsafer for a tiny bit performance!
In C# we have many nice guards sitting on top of static exceptions classes like ArgumentNullException
, ArgumentOutOfRangeException
, etc: As ArgumentException.ThrowIfNullOrEmpty
, ArgumentException.ThrowIfNullOrWhiteSpace
. Now we can extend them easily!
NuGet can cache a lot of packages and other stuffs over time. Here a small rundown on how to clear the biggest chunk.
The dotnet documentation gets hints about using GitHub Copilot. Is this an ad? And can we expect more in the future?
New dotnet version means new features and improvements. There is a nice update to the HttpClient
class in .NET 10.