Skip to content

Blog

Blog

Notes from more than two decades of .NET engineering

APIs, architecture, testing, tooling and teamwork: practical lessons from real projects, with code you can use. Read the latest posts below or browse by series.

136 posts16 series70 tags

Test failures that explain themselves — diffs, curl and contract checks in AspNetCore.Simple.MsTest.Sdk

A bare "Expected:. Actual:<>." is where debugging starts, not where it ends. How AspNetCore.Simple.MsTest.Sdk turns a failing API test into a categorized report with the exact JSON path, the HTTP context, a ready-to-run curl and a suggested fix, and why it checks your test against the endpoint's own contract.

The Throw catalogue — every check in Argument.Check, with real messages

Null checks are the easy part. The interesting guards are the ones for strings, collections, ranges, files and types, plus your own rules in one line. A tour of every Throw helper in Argument.Check, grouped by what you check, with the exact exception each one throws and the handful of details you should know before you rely on them.

What a guard clause costs — benchmarking Argument.Check against hand-written checks

A helper method for every check, isn't that slower than an if? I measured it with BenchmarkDotNet on .NET 10, comparing hand-written guards, the built-in ThrowIfNull family and Argument.Check. Most checks cost the same as an if. Two didn't, the reasons are worth knowing for any library you write, and version 5.0.8 fixed both without breaking anything.