FastMoq Documentation
Welcome to the comprehensive FastMoq documentation! This documentation is designed to help you get the most out of FastMoq, from your first test to advanced enterprise scenarios.
π Release Highlights Since 3.0.0
If you are coming from the last public 3.0.0 package, the biggest changes in the current line are:
- provider-first architecture with explicit provider registration and selection
- new package split across abstractions, database helpers, and provider-specific adapters
- provider-neutral verification with
TimesSpec,Verify(...), andVerifyLogged(...) - fluent
Scenario.With(...).When(...).Then(...).Verify(...)support - explicit policy surfaces for constructor fallback, method fallback, known-type resolution, and optional-parameter behavior
- expanded migration guidance, executable examples, and generated API coverage
π Documentation Structure
π Getting Started
Perfect for developers new to FastMoq. Learn the basics and write your first test in minutes.
- Installation and setup
- Your first FastMoq test
- Provider selection and setup
- Provider capabilities matrix
- Repo-native testing guide
- Web helper guidance for controller and request tests
- Executable testing examples
- Understanding the architecture
- Common patterns and best practices
- Troubleshooting guide
π Feature Parity
Comprehensive comparison of FastMoq with other popular mocking frameworks.
- Side-by-side feature comparison
- Migration guides from Moq and NSubstitute
- Performance and memory usage analysis
- When to choose FastMoq vs alternatives
π¨βπ³ Cookbook
Practical recipes for real-world testing scenarios.
- API Controller testing
- Entity Framework Core with DbContext
- Background Services and hosted services
- HttpClient and external API integration
- Configuration and Options patterns
- Logging verification
- Azure Services integration
- File system operations
ποΈ Sample Applications
Complete, runnable examples demonstrating FastMoq in production-like scenarios.
- E-Commerce Order Processing - Complete sample documentation under
docs/samples/ecommerce-orders - Executable Testing Examples - Smaller repo-local service tests that track current FastMoq guidance
π Benchmarks
Performance analysis and productivity improvements.
- Execution speed comparisons
- Memory usage analysis
- Developer productivity metrics
- Real-world impact studies
- ROI calculations
πΊοΈ Roadmap Notes
Current provider-first direction, active architectural work, and intentionally deferred items.
π What's New Since 3.0.0
Summary of the major architecture, packaging, API, and documentation changes after the May 12, 2025 3.0.0 baseline.
β οΈ Breaking Changes
Intentional v4 breaking changes, with migration notes for changed behavior.
π Migration Guide
Practical guidance for moving from the 3.0.0 public release toward the current v4 provider-first patterns.
π― Quick Navigation
By Experience Level
| Experience | Start Here | Next Steps |
|---|---|---|
| New to Mocking | Getting Started | Simple Cookbook Examples |
| Coming from Moq | Feature Parity | Migration Guide |
| Enterprise Teams | Sample Applications | Performance notes coming in a future published docs pass |
By Use Case
| Use Case | Documentation | Sample Code |
|---|---|---|
| Web APIs | API Controller Testing | E-Commerce Sample |
| Web helper migration | Migration Guide web-helper section | Repo-native testing guide |
| Database Testing | EF Core Testing | Repository Patterns |
| Azure Integration | Sample Applications | Complete Azure App |
| Background Jobs | Background Services | Executable Testing Examples |
| Blazor Apps | Getting Started | Executable Testing Examples |
Package note: FastMoq is the aggregate package. Provider contracts live in FastMoq.Abstractions, FastMoq.Core stays lighter, EF-specific helpers live in FastMoq.Database, provider-specific adapters live in FastMoq.Provider.*, and web helpers live in FastMoq.Web while the primary calls stay in the FastMoq namespace.
Web helper note: if your test project references the aggregate FastMoq package, the web helpers are already included. If your test project references FastMoq.Core directly, add FastMoq.Web before using helpers such as CreateHttpContext(...), CreateControllerContext(...), SetupClaimsPrincipal(...), AddHttpContext(...), or AddHttpContextAccessor(...).
See Getting Started package choices when you need the full install matrix instead of a quick reminder.
π Key Advantages
FastMoq is designed for developer productivity and maintainable tests:
π Less Code, More Testing
- 70% reduction in test setup code
- Automatic dependency injection eliminates boilerplate
- Fluent API for readable test scenarios
β‘ Better Performance
- 50% faster test execution
- 60% less memory usage
- Better scalability for large test suites
ποΈ Modern .NET Patterns
- Built-in support for EF Core, HttpClient, IFileSystem
- Azure services integration
- Configuration and Options patterns
- Blazor and Web testing
π§ Enterprise Ready
- Comprehensive logging verification
- Advanced scenarios support
- Team productivity improvements
- Migration tools from other frameworks
π Learning Path
1. Foundation (30 minutes)
- Read Getting Started
- Try the first test example
- Understand MockerTestBase
2. Practical Application (1 hour)
- Pick a relevant cookbook recipe
- Try it in your own project
- Explore advanced setup options
3. Production Readiness (2-3 hours)
- Study a complete sample application
- Review the current sample and migration guidance
- Plan your migration strategy
4. Mastery (Ongoing)
- Explore all cookbook patterns
- Adapt sample applications to your domain
- Contribute back to the community
π€ Community and Support
Getting Help
- Documentation: You're here! Start with the most relevant section above
- Issues: GitHub Issues for bugs and feature requests
- Discussions: GitHub Discussions for questions and community help
- API Reference: Complete API Documentation
Contributing
We welcome contributions! See our:
Stay Updated
- β Star the repository for updates
- π Watch releases for new versions
- π¦ Follow discussions for community insights
π External Links
- NuGet Package: FastMoq on NuGet
- GitHub Repository: cwinland/FastMoq
- API Documentation: Complete API Reference
- Release Notes: GitHub Releases
π·οΈ Version Information
This documentation tracks the current post-3.0.0 FastMoq v4 release line.
Ready to get started? Jump to Getting Started or pick a specific topic from the navigation above!