cover

C# 12 news that didn’t make it into separate posts

C# 12 has been released November 2023. I’ve written separate articles about each of the new features: C# 12 - Primary constructor C# 12 - Collection expressions Simplify tuple types...

Testing with properties using FsCheck

I assume that most of us use a technique called example-based testing when writing unit tests. This technique is based on writing tests that verify the behavior of our functions...

Boxing & UnBoxing - Back to the basics

Unless you know what Boxing and UnBoxing (no UnBoxing is not fancy unboxing a new iPhone by your favorite youtuber) is, don’t read this post. In all likelihood, you won’t...

Test your architecture with NetArchTest

Do you have an architecture type defined on the project? Onion / Clean / Vertical Slice / … architecture? Or do you have your own architecture rules? How do you...

Simplify tuple types using aliases

Are you a fan of functional programming, or do you just like using tuple types? In that case your code might look something like this: static (decimal score, string grade)...

Time travel with TimeProvider

If you write unit tests you know that using DateTime.Now directly is not a good idea 🤔. You probably have something like IDateTimeProvider or something similar in your project. 🌠...

WireMock.NET

❓ How do you write unit/integration tests for functionality that depends on a third party API? We at KROS a.s. use WireMock.NET library, which elegantly allows you to create a...

Multi-Tenant Output Cache Policy

🚀 ASP.NET Core Output Cache for MultiTenancy Services In the previous post, I showed how to use the ASP.NET Core output cache. I mentioned that it is not sutible for...

Output cache with ASP.NET Core

🚀 Speed up your API with output caching. ASP.NET Core since version 7 offers outcaching out of the box. Just use the AddOutputCache method to add configuration to the DI...

Stryker.NET

💡 #unittest #tip - Test your tests with #stryker How do you verify the quality of your unit tests? Do you use code coverage metrics or something else? A good...

C# Puzzles

Happy New Year fellow dotnet developers! 🎆 Kickstart 2024 with the C# challenge. I have prepared 5 interesting (not entirely useful 🙂) C# puzzles. Can you solve some of them?...

ASP.NET Core - Request timeout

🚀 ASP.NET Core #news - Request timeout Request timeout is a new feature in ASP.NET Core 8.0 that allows you to set a timeout for a request. This feature is...

ASP.NET Core Short-circuit

🚀 ASP.NET Core #news - Short-circuit Short-circuit is a new feature in ASP.NET Core 8.0 that allows you to skip the entire request pipeline and return a response directly from...

ASP.NET Core - IExceptionHandler

🚀 ASP.NET Core #news - IExceptionHandler IExceptionHandler is a new interface in ASP.NET Core 8.0 that provides the ability to extract global exception handling into separate classes.

C# 12 - Collection expressions

🚀 #csharp 12 - #collectionexpressions I have been developing in .NET for over 16 years, but even now I struggle when I have to create and initialize a simple array....