Testing
SignalR Testing Guide: .NET Unit Tests and Playwright Integration
SignalR is Microsoft's real-time web framework that abstracts over WebSockets, Server-Sent Events, and long polling.
Testing
SignalR is Microsoft's real-time web framework that abstracts over WebSockets, Server-Sent Events, and long polling.
Testing
The .NET ecosystem has two mature approval/snapshot testing libraries: ApprovalTests.Net (the original) and Verify (the modern alternative with better async support and scrubbing). Both capture output to files and compare on subsequent runs. This guide covers both libraries with practical C# examples for NUnit and xUnit. Key Takeaways
Azure
Azure Functions testing has a reputation for being awkward. The dependency on function bindings, the ILogger injection pattern, and the mix of trigger types make standard unit testing feel clunky. With the right structure, though, Azure Functions are as testable as any other C# code. Project Structure for Testability The
Testing
SpecFlow is the .NET implementation of the Cucumber/Gherkin BDD framework.
Test Automation
.NET has a mature test automation ecosystem built around three layers: unit tests (xUnit/NUnit/MSTest + Moq), integration tests (WebApplicationFactory, Testcontainers), and end-to-end tests (Playwright, Selenium). This guide covers setting up all three layers, structuring a test project, running tests in CI, and measuring coverage. Key Takeaways Three-
Integration Testing
Integration testing in .NET means testing your application with real dependencies — real HTTP routing, real database queries, real middleware. WebApplicationFactory from Microsoft.AspNetCore.Mvc.Testing spins up your actual ASP.NET Core app in memory, letting you send real HTTP requests without a running server. This guide covers setup, database
Tools & Frameworks
Moq is the most popular mocking library for .NET. It lets you replace real dependencies (databases, email services, HTTP clients) with controlled fakes in unit tests. This guide covers Setup, Verify, argument matchers, callbacks, async mocks, and common patterns for writing isolated C# tests. Key Takeaways Mock<T>
Tools & Frameworks
.NET developers choose between three major testing frameworks: MSTest (Microsoft's built-in framework), xUnit.net (the modern default, used by the .NET team itself), and NUnit (the most feature-rich, JUnit-inspired option). All three are production-ready. The right choice depends on your team's background,
Tools & Frameworks
NUnit is one of the oldest and most feature-rich .NET testing frameworks. It inspired xUnit.net and shares ideas with JUnit. This guide covers setup, writing tests, parameterized tests with TestCase, constraint-based assertions, setup and teardown, and integrating NUnit into CI pipelines. Key Takeaways NUnit uses [Test] and
Tools & Frameworks
xUnit.net is the most modern .NET testing framework, favored by Microsoft's own teams and the open-source community. It's the default choice for new .NET projects. This guide covers installation, writing Facts and Theories, using assertions, mocking dependencies, async testing, and running tests in CI