testing
C# and .NET Unit Testing Articles, Tutorials & News
C# and .NET Unit Testing articles, tutorials, and news from the DotNetNews archive.
169 articles Updated
C# and .NET Unit Testing work shows up across many DotNetNews issues because teams keep hitting the same implementation questions. C# and .NET Unit Testing is the verification side of C# delivery, from unit suites to the habits that keep regressions cheap.
Recurring subtopics in recent issues include C# unit testing, .NET unit tests, mocking C#, and test doubles .NET. When a subtopic never appears in the archive titles or excerpts, it is left out of this introduction.
Expect publisher tutorials, release notes, architecture write-ups, and field notes linked from DotNetNews issues. Start here is a short editorial shortlist for C# and .NET Unit Testing; the archive list is chronological and larger. Secondary angles such as C# unit testing and .NET unit tests appear when the archive actually covered them. Cross-links to xUnit for C# and .NET and Test-Driven Development in C# help when the problem spans more than one tag.
Start here
Editor picks for Unit Testing
-
How to Implement Unit Testing in .NET using xUnit with Example
C# Corner Issue #439
A practical xUnit primer that fits newer .NET developers and teams trying to build better testing habits before bugs escape into production.
-
ASP.NET Community Standup - Vibe coding a C# MCP server
YouTube Issue #292
The ASP.NET Community Standup on vibe coding a C# MCP server is a good snapshot of where the platform is headed.
-
Types of Unit Tests in C# — Master Testing Like a Pro
Medium Issue #289
A thorough unit-testing guide covering mocks, async tests, and property-based testing.
-
Life Tracker — A .NET App 3: NUnit testing
Medium Issue #273
The NUnit testing entry is a nice nod to the testing side of app development, even if it's more personal than prescriptive.
-
Cracking the Code of Unit Testing in .NET
C# Corner Issue #237
Unit testing in .NET gets a familiar but valuable treatment for anyone trying to write more reliable code.
-
The Critical Importance of Unit Testing for APIs in C#.NET Development
Medium Issue #177
Strong case for API unit tests here; reliability still starts with fast feedback.
-
Comprehensive Guide to Unit Testing with MSTest in C#
csharp.com Issue #156
https://www.csharp.com/article/comprehensive-guide-to-unit-testing-with-mstest-in-c-sharp/.
-
How to Test Vertical Slice Architecture
Milan's .NET Weekly Issue #495
Useful look at testing in vertical slice systems, especially if layered-architecture habits keep leaking into feature-based codebases.
Archive
Page 1 of 7
Newest first
-
How to Mock External HTTP APIs in .NET Integration Tests
C# Corner Issue #574
Learn how to mock external HTTP APIs in .NET integration tests with a custom HttpMessageHandler, HttpClient, and xUnit to test successful and error responses reliably.
-
Unwiring WireMock .NET: Elevate Your API Testing
Medium Issue #574
Overview: WireMock .NET is a free, open-source C# tool that lets integration tests talk to a simulated API over HTTP instead of real…Continue reading on T.8ytes by Titansoft »
-
How to Mock External HTTP APIs in .NET Integration Tests
C# Corner Issue #569
Learn how to mock external HTTP APIs in .NET integration tests with a custom HttpMessageHandler, including success, error, and not-found response scenarios.
-
How to Mock External HTTP APIs in .NET Integration Tests
C# Corner - Nidhi Sharma Issue #569
Learn how to mock external HTTP APIs in ASP.NET Core integration tests by replacing HttpMessageHandler for typed HttpClient instances in WebApplicationFactory.
-
Testing Payment Retries Without Charging Customers Twice
C# Corner - Vivek Kumar Issue #569
Learn how to test payment retry logic in C# using idempotency keys, explicit payment states, and simulated timeout scenarios to prevent duplicate charges.
-
Dew Drop - October 6, 2026 (#4764)
Morning Dew by Alvin Ashcraft Issue #567
Top Links UWP and WinUI 3 apps: UI testing with MSTest (Amaury Levé) Hello, Aspire 13.6 (Maddy Montaquila) Ink comes to WinUI 3 (Pranav Gupta) Voice agents in Foundry Agent Service: architecture, trus...
-
How to Test WebSocket Reconnection and Network Failures in .NET
C# Corner Issue #566
Learn how to test .NET WebSocket clients for message handling, fragmented frames, network failures, server shutdowns, and reconnection behavior using unit and integration tests.
-
MSTest UI Testing for WinUI 3: Testing Packaged and Unpackaged Apps
C# Corner - Saurav Kumar Issue #566
Learn how to configure MSTest UI-thread tests for packaged and unpackaged WinUI 3 apps using MSTest.Sdk and Microsoft.Testing.Platform.
-
Test Time-Dependent Code Without Waiting
Milan's .NET Weekly - [email protected] (Milan Jovanović) Issue #564
I have time-dependent code in my application that I need to test. An invitation that expires after five minutes is a good example: I want to check the deadline…
-
Your code reads secrets from Vault. What do you test it against?
Medium - Ferhat Talha BULANIK Issue #563
I wrote a small package that starts and stops a real Vault from inside .NET
-
Run MSTest Tests With Native AOT and Trimming Enabled
C# Corner - Saurav Kumar Issue #561
-
Bulletproof Testing: Integration Testing Web APIs with WebApplicationFactory
C# Corner - Sardar Mudassar Ali Khan Issue #560
Learn to integration test ASP.NET Core Web APIs with xUnit and WebApplicationFactory, including dependency injection overrides, in-memory databases, and end-to-end HTTP tests.
-
Testing beyond your imagination: Property-based testing in C# with FsCheck
Code4IT Issue #549
Property-based testing is a powerful alternative to example-based testing. Instead of defining specific inputs and verifying their outcomes, you define properties that should always hold true. Let&rsq...
-
Today I will... improve test coverage
Microsoft Dev Blogs Issue #548
Today I want to look at how we can improve on the test coverage that we have in the Interview Coach application. This application has some unit tests in it already, but I'm sure there is room for impr...
-
-
.NET Aspire Integration Testing Best Practices for Distributed Applications
Medium Issue #547
A while ago, I published an article about ASP.NET Core Integration Testing Best Practices. WebApplicationFactory, TestContainers, and… Continue reading on CodeX »
-
Microsoft Agent Framework Harness: Testing AI Agents with Evals and OpenTelemetry
C# Corner Issue #544
Learn how to build a Microsoft Agent Framework testing harness using evaluations and OpenTelemetry to measure AI agent behavior, tool calls, latency, failures, and reliability.
-
Run temporary containers in .NET tests with Meziantou.Framework.TemporaryContainers
Meziantou's blog Issue #543
Integration tests are much more valuable when they run against real services. Instead of mocking a database or cache, you can start a temporary container, run your test, and dispose everything at the ...
-
Testing AI Agents When External Web Sources Become Unavailable
C# Corner Issue #543
Learn how to test AI agents when web search and external sources fail, including timeout handling, fallback strategies, graceful degradation, and response validation.
-
Microsoft.Testing.Platform: Detecting Flaky Tests in .NET CI/CD Pipelines
C# Corner Issue #540
Learn how Microsoft.Testing.Platform can help detect flaky tests in .NET CI/CD pipelines using repeatable test execution, diagnostics, reporting, and automated analysis.
-
Benchmarking AI-Generated Unit Tests Against Human-Written Tests
C# Corner Issue #540
Learn how to benchmark AI-generated unit tests against human-written tests using code coverage, mutation scores, defect detection, false positives, readability, and maintainability.
-
Test what you ship: MSTest and Native AOT
Microsoft Dev Blogs Issue #538
If you ship an application with Native AOT, a green managed test run leaves a gap. Native AOT compiles ahead of time, removes unused code, and requires alternatives to runti
-
Find and Fix Failing Tests Faster in VS Code
YouTube Issue #533
Got a failing test in CI? See how VS Code’s Test Explorer makes it easy to filter your tests, find the failure, debug the issue, view test results, and rerun the test—all without leaving VS Code. #vsc...
-
Building Agentic QA Pipelines with Browser Automation and .NET
C# Corner Issue #531
Learn how to build agentic QA pipelines with Playwright for .NET and AI agents, including browser automation, agent memory, tool control, execution limits, and testing best practices.
-
Mock It or Don’t? How to Decide What to Mock in Unit Tests
Medium Issue #527
When we start writing unit tests in .NET, we quickly run into an important question: