GitHub Copilot Testing for .NET: AI-Powered Unit Tests That Actually Build and Run
Visual Studio 2026 ships a purpose-built @Test agent that generates, builds, runs, and self-heals C# unit tests across your entire solution. Here is how the workflow operates, what it does well, and where you still need to think for yourself.
VSTest Drops Newtonsoft.Json: What Changes for Your Test Projects in .NET 11
VSTest is removing its long-standing Newtonsoft.Json dependency in .NET 11 Preview 4, switching to System.Text.Json on .NET and JSONite on .NET Framework. Here's what breaks, why it matters, and how to fix it.
UnsafeAccessorAttribute: Zero-Overhead Private Member Access Without Reflection
UnsafeAccessorAttribute lets you access private fields, methods, and constructors at the same speed as direct calls — no reflection, no Reflection.Emit, and full Native AOT compatibility. Here's how to use it, when it makes sense, and where developers trip up.
TypedResults: The Minimal API Return Type That Writes Your OpenAPI Spec for You
TypedResults and the Results<T1, T2> union pattern give Minimal API endpoints compile-time safety, automatic OpenAPI metadata, and cleaner unit tests. Here is how to use them properly and why they should be your default.
TUnit: The Source-Generated Testing Framework That Skips Reflection Entirely
TUnit replaces runtime reflection with compile-time source generation for test discovery, delivering faster execution, Native AOT support, and compile-time safety that xUnit, NUnit, and MSTest cannot match.
TimeProvider: Finally, Testable Time in .NET
How System.TimeProvider in .NET 8 replaces years of IClock wrappers with a first-class abstraction for testable, deterministic time — and how FakeTimeProvider makes testing time-dependent code straightforward.
Integration Testing with .NET Aspire
Use Aspire's testing support to write integration tests that spin up real infrastructure and validate your services end to end.
Testing Source Generators with Microsoft.CodeAnalysis.Testing
A practical guide to testing source generators and analysers using the official Microsoft.CodeAnalysis.Testing framework.
Code Coverage in CI for .NET Projects
Collect, report, and enforce code coverage thresholds in your .NET CI pipeline using Coverlet and ReportGenerator.
Respawn: Fast Database Reset Between Integration Tests
Use Respawn to intelligently reset your test database between tests without the overhead of dropping and recreating it.
Testing Async Code in .NET: Patterns and Pitfalls
Practical patterns for testing asynchronous .NET code correctly, including common mistakes that lead to false-passing tests.
Mutation Testing with Stryker.NET: Are Your Tests Actually Good?
Use Stryker.NET to evaluate the real effectiveness of your test suite by introducing deliberate mutations to your code.
Architecture Testing in .NET with NetArchTest
Enforce architectural rules as automated tests using NetArchTest to prevent dependency violations and structural drift.
End-to-End UI Testing with Playwright for .NET
Use Playwright's .NET bindings to write reliable, cross-browser end-to-end tests for your web applications.
Generating Realistic Test Data with Bogus in .NET
Use the Bogus library to generate realistic fake data for your .NET tests with deterministic, locale-aware data generation.
Test Data Builders in .NET: Clean, Maintainable Test Setup
The test data builder pattern helps you construct complex test objects with sensible defaults while keeping tests readable and maintainable.
FluentAssertions Patterns for Clearer .NET Tests
Practical patterns for using FluentAssertions to write expressive, self-documenting test assertions in .NET.
Snapshot Testing in .NET with Verify
Use the Verify library to catch unintended changes in your API responses, serialised objects, and complex outputs through snapshot testing.
Moq vs NSubstitute: .NET Mocking Libraries Compared
A head-to-head comparison of Moq and NSubstitute covering syntax, features, and which to choose for your .NET tests.
Testcontainers for .NET: Real Database Integration Tests
Use Testcontainers to spin up real database instances in Docker for integration tests that mirror production behaviour.
Integration Testing ASP.NET Core with WebApplicationFactory
How to use WebApplicationFactory to write fast, reliable integration tests for your ASP.NET Core APIs without deploying anything.
xUnit vs NUnit vs MSTest: Choosing Your .NET Test Framework
A practical comparison of the three major .NET test frameworks to help you pick the right one for your project.