testing
C# and .NET Unit Testing Articles, Tutorials & News
C# and .NET Unit Testing articles, tutorials, and news from the DotNetNews archive.
143 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-sharpcorner.com 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.com 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.com Issue #289
A thorough unit-testing guide covering mocks, async tests, and property-based testing.
-
Life Tracker — A .NET App 3: NUnit testing
jackymlui.medium.com 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-sharpcorner.com 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.com 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
milanjovanovic.tech 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 6
Newest first
-
Mock It or Don’t? How to Decide What to Mock in Unit Tests
vahid-faraji-dev.medium.com Issue #527
When we start writing unit tests in .NET, we quickly run into an important question:
-
Testcontainers: Real Dependencies in Disposable Docker Containers
medium.com Issue #527
A focused, mechanics-level guide to Testcontainers — the library that programmatically starts and stops real Docker containers as part of…
-
xUnit: The Modern .NET Unit Testing Framework
medium.com Issue #525
A practical guide to xUnit — the most widely used unit testing framework for .NET — covering test structure, assertions, fixtures and…
-
Building Agentic QA Pipelines with Browser Automation and .NET
c-sharpcorner.com Issue #524
Build robust agentic QA pipelines in .NET. Separate AI reasoning from deterministic browser execution for faster, more reliable testing.
-
Snapshot testing in .NET with Meziantou.Framework.SnapshotTesting
meziantou.net Issue #523
Snapshot testing is a technique where the output of a function or component is serialized and saved to disk the first time the test runs. On every subsequent run, the library re-serializes the output ...
-
Testing Global .NET Test Timeouts with Microsoft.Testing.Platform
c-sharpcorner.com Issue #523
Learn how global test timeouts and maximum-failure controls in Microsoft.Testing.Platform can improve CI reliability and prevent stalled or excessive test runs.
-
Preventing Architecture Drift with Executable Dependency Rules
c-sharpcorner.com Issue #522
Prevent architecture drift with executable dependency rules. Turn architectural decisions into automated tests for C# applications using ArchUnitNET.
-
Unit Testing Enterprise Multi-Agent LangGraph Systems
c-sharpcorner.com Issue #517
Master unit testing for enterprise LangGraph systems. Learn to mock async tools, LLMs, and test state persistence for robust AI deployments.
-
Control String Comparison in .NET JSON Assertions
blog.devgenius.io Issue #517
JSON assertions usually require exact values, but casing is not always meaningful. For example, an API might return "ACTIVE" while a test… Continue reading on Dev Genius »
-
Write your first architecture fitness test
medium.com Issue #515
Your Clean Architecture diagram is a hope, not a guarantee, until something fails the build when it is violated. Here is how to add…
-
Automating Software Architecture Validation with ArchUnitNET
c-sharpcorner.com Issue #515
Automate software architecture validation with ArchUnitNET for ASP.NET Core. Ensure clean architecture, detect violations early, and integrate into CI/CD.
-
From generated code to trusted code with a unit-test agent
devblogs.microsoft.com Issue #512
A common request to a coding agent is only one line: Generate unit tests. That request leaves important questions open. Which code needs tests? Which test framework does the project use? Where should ...
-
Playwright Testing for ASP.NET Core Applications: A Practical Guide
c-sharpcorner.com Issue #508
Master Playwright for ASP.NET Core E2E testing. Learn setup, writing tests, best practices, and CI/CD integration for reliable web app validation.
-
Testing Minimal APIs: The Complete Playbook
medium.com Issue #507
Minimal APIs threw out the controller ceremony — which also means the old “just unit test the controller” playbook doesn’t fully apply…
-
Delete AutoMapper: explicit, compile-time DTO mapping that you can actually test
medium.com Issue #507
Reflection-based mappers feel like they save you work until the day a renamed property silently maps to null in production. Here is the…
-
How to Test Vertical Slice Architecture
milanjovanovic.tech Issue #495
The most common question I get about vertical slice architecture isn't about structure. It's "where do my tests go?" The layered-architecture testing habits (mock the repository, test the service) don...
-
Using AI to Generate Better Unit Tests for Bug Reproduction in .NET
blog.stackademic.com Issue #495
Turn bug reports into reliable unit tests using the AI Continue reading on Stackademic »
-
Test Automation Best Practices with Microsoft Playwright
c-sharpcorner.com Issue #494
Master Microsoft Playwright with best practices for reliable, scalable, and maintainable test automation. Boost confidence and speed.
-
No more regressions with Snapshot Tests in C# using Verify: a practical guide
code4it.dev Issue #493
Snapshot Tests are an uncommon type of test that focuses on checking that no regressions were introduced after a code refactoring. Let’s learn how they work and how to use the Verify NuGet libra...
-
Repository Pattern in C#: Build Clean, Testable, and Maintainable .NET Applications
medium.com Issue #490
Learn how the Repository Pattern works in modern .NET
-
GitHub Copilot Generated Our .NET Tests. It Missed What Mattered Most
medium.com Issue #489
There has been plenty of discussion recently about AI replacing parts of software testing, so we decided to see how far we could actually…
-
The mock-as-private-field pattern only half-works the way you think
medium.com Issue #488
I ran into this recently while cleaning up our test classes at work, and it’s a good example of how a pattern can be “correct” in one…
-
Mastering .NET Interviews – Part 9: Testing & Performance
c-sharpcorner.com Issue #487
Master .NET interviews: Learn unit/integration testing, mocking, DI, and performance tuning (caching, async, profiling).
-
AI-Powered Test Case Generation for Enterprise .NET Applications
c-sharpcorner.com Issue #485
Automate .NET test case generation with AI. Enhance coverage, reduce errors, and accelerate enterprise application delivery.
-
How to Simplify ASP.NET Core API Testing
medium.com Issue #484
When developing applications, we strive to avoid code duplication. We extract commonly used code into libraries and use DI containers to…