1325 questions for senior .NET engineer interviews, each with a 30-second answer, the full answer, a deep dive, the follow-ups interviewers ask next, and real-world production problems.
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.
Testing time-dependent .NET code with the TimeProvider abstraction and FakeTimeProvider: injecting the clock, advancing virtual time, testing PeriodicTimer and Task.Delay, and avoiding races with asynchronous continuations.
Testing async .NET code: async test methods, avoiding .Result and async void, asserting cancellation with ThrowsAnyAsync, timeouts with TestContext.Current.CancellationToken, and testing Channel-driven BackgroundService workers deterministically.
Test data strategy for systems with personal information: object mothers and test data builders, Bogus with fixed seeds, per-test seeding and reset, masked production copies versus synthetic data, and Australian Privacy Act and Notifiable Data Breaches implications.
Testing legacy .NET code: characterisation (golden master) tests, Michael Feathers' seams, sprout and wrap methods, extract-interface and parameterise-constructor refactorings, snapshotting outputs with Verify, and choosing safe first refactorings.
Debugging flaky .NET tests: reproducing with repeat runs and constrained resources, classifying causes (time, ordering, shared state, parallelism, async races, external dependencies), xUnit collections and parallelism, blame-hang diagnostics, quarantine policy and permanent fixes.
Consumer-driven contract testing in .NET with PactNet: writing consumer tests against the Pact mock server with matchers, verifying the provider against a real host with provider states, and using a Pact Broker, pending pacts and can-i-deploy to gate deployments.
Testing distributed .NET systems: component tests with real dependencies in containers, .NET Aspire integration tests, contract tests, asserting eventual consistency, fault injection with Polly chaos strategies and Azure Chaos Studio, and testing in production with synthetic monitoring, canaries and feature flags.