UnitTestingAndBenchmarkingExample
A practice repo pairing xUnit tests with BenchmarkDotNet benchmarks, because "it works" and "it works fast enough" are answered with different tools.
What it demonstrates
A small InventoryService has two versions of the same method: AddStock_Old, which just appends a stock entry, and AddStock, which adds a duplicate-product check first. Unit tests cover both for correctness, and a BenchmarkDotNet benchmark (with [MemoryDiagnoser]) measures what that extra check actually costs in time and allocations, turning "this is probably fine" into a number.
Why it exists
Built as a learning/practice project, not for a specific work problem, a place to get comfortable pairing tests and benchmarks on the same piece of code, rather than treating them as separate concerns.
Technology
.NET, C#, xUnit, BenchmarkDotNet
Tests, but no numbers?
If your team has tests but no measurements of what a change costs (or the reverse), pairing the two on the same code makes the trade-off visible. I can help set that up. Get in touch.
View on GitHub