Asserting EF Core query counts alongside Testcontainers #1680
KiwiDevelopment
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Testcontainers gives you a real database in tests — which is great. But one thing I kept missing was a way to assert how many queries were executed during a test, not just that the result is correct.
I built a small library for this: KiwiQuery.EFCore.
It wraps DbCommandInterceptor so you don't have to write the boilerplate. Works naturally with Testcontainers since you're already hitting a real DB — the interceptor just counts what goes through.
Repo: https://github.com/KiwiDevelopment/KiwiQuery, NuGet: KiwiQuery.EFCore. MIT, one dependency.
Curious if others have solved this differently or if there's interest in this pattern.
Beta Was this translation helpful? Give feedback.
All reactions