Testing .NET 10 systems with confidence: the test types and when each pays off, the .NET testing tools (xUnit, NSubstitute, Testcontainers, WebApplicationFactory), good testing practice, and senior topics such as legacy code, async and time, flaky tests and contract testing.
-
Which assertion library would you use in a .NET test project in 2026? Explain what happened to FluentAssertions' licence, compare the alternatives (AwesomeAssertions, Shouldly, the framework's built-in asserts), and tell me how you'd decide.
Covers the FluentAssertions v8 move to a commercial Xceed licence, the AwesomeAssertions fork, Shouldly, built-in xUnit/NUnit/MSTest asserts, structural equivalence, failure-message quality and how to choose and migrate.
Intermediate
Theory
.NET Testing Tools
Β· π 2 follow-ups
-
How do you test an ASP.NET Core API in memory with WebApplicationFactory? Show how you replace services for a test, handle authentication so protected endpoints can be called, and keep tests isolated from each other.
Covers WebApplicationFactory and TestServer: bootstrapping Program, ConfigureTestServices to swap dependencies, a test authentication handler for protected endpoints, per-test configuration, isolation and what in-memory tests do and do not prove.
Mid-Level
Coding
.NET Testing Tools
Β· π 2 follow-ups Β· π 1 real-world
-
How do you use Testcontainers for .NET to run tests against a real SQL Server and Redis? Show the fixture, explain how you keep the tests fast (sharing, reuse, resetting data) and what you need to run them in CI.
Covers Testcontainers for .NET modules for SQL Server and Redis, IAsyncLifetime fixtures, sharing containers per class or collection, container reuse, resetting data with Respawn, wait strategies, Ryuk clean-up, and running in GitHub Actions and Azure Pipelines.
Mid-Level
Coding
.NET Testing Tools
Β· π 2 follow-ups Β· π 1 real-world
-
Your service calls a third-party HTTP API. How do you use WireMock.Net to test it, including the API being slow, returning errors or sending malformed responses? Show how you wire it into the app under test and verify what was sent.
Covers WireMock.Net as a real HTTP stub server for outbound calls: request matching, JSON responses, delays, faults and stateful scenarios, wiring the base URL into WebApplicationFactory, verifying requests from the log, and testing resilience pipelines.
Mid-Level
Coding
.NET Testing Tools
Β· π 2 follow-ups Β· π 1 real-world
-
What are AutoFixture and the test data builder pattern? How do they reduce setup noise in tests, when do they hurt readability, and how would you choose between AutoFixture, Bogus and hand-written builders?
Covers AutoFixture (Create, Build/With, AutoData, Frozen, AutoNSubstitute), hand-written test data builders and Object Mothers, Bogus for realistic synthetic data, and the trade-off between anonymous values and readable, intention-revealing tests.
Intermediate
Theory
.NET Testing Tools
Β· π 2 follow-ups
-
Code review: a test project for an order-processing service mocks every class including the repository and DbContext, waits for background work with Thread.Sleep(3000), shares a static list and DateTime.Now between tests, and asserts on exact log message text through a mocked ILogger. What is wrong, in order of severity, and how would you rewrite it?
A senior code review of a brittle .NET test suite: tests that cannot fail, shared static state, Thread.Sleep waits, real clock usage, over-mocking and log-text assertions, ranked by severity, with a rewrite using FakeTimeProvider, FakeLogger, real infrastructure and deterministic waits.
Senior
CodeReview
.NET Testing Tools
Β· π 2 follow-ups Β· π 1 real-world
-
What is the Arrange-Act-Assert pattern? How do you name unit tests so a failure explains itself, and why should each test check one behaviour?
Covers the Arrange-Act-Assert structure, test naming conventions, the one-behaviour-per-test rule, and how they make xUnit test failures readable.
Beginner
Theory
Testing Practices
Β· π 2 follow-ups
-
What is the difference between a stub and a mock? Explain state verification versus behaviour verification, the classicist and mockist schools, and how that choice affects your .NET tests.
Covers stubs versus mocks, state versus behaviour (interaction) verification, classicist versus mockist TDD, and how each choice shapes NSubstitute-based tests in .NET.
Junior
Theory
Testing Practices
Β· π 3 follow-ups
-
What is test-driven development? Walk me through red-green-refactor, where TDD genuinely helps, where it doesn't, and how you actually use it on a .NET team.
Covers the TDD cycle (red, green, refactor), its design and regression benefits, where it fits poorly, and pragmatic use of TDD on .NET teams.
Intermediate
Theory
Testing Practices
Β· π 2 follow-ups
-
What is the test pyramid, and how does it differ from the testing trophy and the honeycomb? How would you balance unit and integration tests for a typical ASP.NET Core API backed by SQL Server?
Covers the test pyramid, the testing trophy and the microservice honeycomb, and how to choose the mix of unit, integration and end-to-end tests for an ASP.NET Core API.
Intermediate
Theory
Testing Practices
Β· π 3 follow-ups
-
How do you use snapshot testing with Verify in a .NET project? Show how you snapshot an API response, scrub volatile values like ids and timestamps, and handle accepting changes in CI.
Covers Verify snapshot testing in xUnit: received and verified files, snapshotting API responses, scrubbing volatile data, global settings and the review workflow in CI.
Mid-Level
Coding
Testing Practices
Β· π 2 follow-ups Β· π 1 real-world
-
How do you test EF Core data access against a database? Compare the EF Core in-memory provider, SQLite and a real SQL Server in a container, and explain how you reset state between tests with Respawn or transactions.
Covers the options for database testing with EF Core (in-memory provider, SQLite, SQL Server via Testcontainers), their fidelity gaps, and resetting state with Respawn, transaction rollback or per-test databases.
Mid-Level
Theory
Testing Practices
Β· π 3 follow-ups Β· π 1 real-world
-
What is over-mocking? Explain the difference between testing behaviour and testing implementation details, why mock-heavy tests break when you refactor, and how you would fix a suite like that.
Covers over-mocking, behaviour versus implementation-detail tests, why interaction-heavy tests are brittle under refactoring, and practical ways to move a .NET suite towards behaviour-focused tests.
Mid-Level
Theory
Testing Practices
Β· π 3 follow-ups Β· π 1 real-world
-
Your .NET solution's CI test stage has grown to 35 minutes and developers are batching changes to avoid it. How would you redesign the test suite and pipeline so pull requests get fast feedback without losing confidence? Cover parallelism, test splitting, containers and what runs on every PR versus later.
Covers making a .NET test suite fast in CI: measuring where time goes, xUnit parallelism, sharding across agents, container reuse, test selection, and deciding what runs on every PR, on merge and nightly.
Senior
Architecture
Testing Practices
Β· π 3 follow-ups Β· π 1 real-world
-
How would you replace the clock in an ASP.NET Core integration test so retries, cache expiry and your own rules all use the same fake time?
Mid-Level
Coding
Senior Testing Topics
-
How would you test that a worker never processes more than four messages at the same time?
Mid-Level
Coding
Senior Testing Topics
-
A tester needs production-like data in UAT to reproduce a bug a customer reported. What do you do?
Mid-Level
Theory
Senior Testing Topics
-
How do you know your characterisation tests are good enough to start changing the code?
Senior
Theory
Senior Testing Topics
-
How do you write a contract for an asynchronous message, such as an OrderPlaced event on Azure Service Bus?
Senior
Coding
Senior Testing Topics
-
How would you test that a message consumer is idempotent when the broker delivers the same message twice?
Senior
Theory
Senior Testing Topics