F# Testing Patterns
Comprehensive testing patterns for F# applications using xUnit, FsUnit, Unquote, FsCheck, and modern .NET testing practices.
When to Activate
- Writing new tests for F# code
- Reviewing test quality and coverage
- Setting up test infrastructure for F# projects
- Debugging flaky or slow tests
Test Framework Stack
Unit Tests with xUnit + FsUnit
Basic Test Structure
Assertions with Unquote
Unquote uses F# quotations so failure messages show the full expression that failed, not just "expected X got Y".
Async Tests
Parameterized Tests with Theory
Property-Based Testing with FsCheck
Using FsCheck.xUnit
Custom Generators
Mocking Dependencies
Function Stubs (Preferred)
NSubstitute for .NET Interfaces
ASP.NET Core Integration Tests
Test Organization
Common Anti-Patterns
Related Skills
dotnet-patterns- Idiomatic .NET patterns, dependency injection, and architecturecsharp-testing- C# testing patterns (shared infrastructure like WebApplicationFactory and Testcontainers applies to F# too)


