This project contains two types of tests to ensure comprehensive coverage:
Purpose: Fast, isolated tests that don't require external dependencies.
- ✅ No database required - Run anywhere, anytime
- ✅ Fast execution - Complete in seconds
- ✅ Parameter validation - Test input validation logic
- ✅ Business logic - Test pure functions and data structures
- ✅ Mocking - Test interfaces and dependency injection
Run unit tests only:
dotnet test --filter "FullyQualifiedName~ToolsUnitTests"Purpose: End-to-end testing with real SQL Server database.
- 🔌 Database required - Tests full SQL Server integration
- 📊 Real data operations - Creates tables, stored procedures, functions
- 🧪 Complete workflows - Tests actual MCP tool execution
- ⚡ 14 original tests - Core CRUD and error handling scenarios
Prerequisites for integration tests:
- SQL Server running locally
- Database named 'test'
- Set environment variable:
SET CONNECTION_STRING=Server=.;Database=test;Trusted_Connection=True;TrustServerCertificate=True
Run integration tests only:
dotnet test --filter "FullyQualifiedName~MssqlMcpTests"Run all tests:
dotnet test- ✅ Unit: Parameter validation and structure
⚠️ Integration: Not included - Use unit tests for validation
- ✅ Unit: Parameter validation and structure
⚠️ Integration: Not included - Use unit tests for validation
- ✅ Unit: Interface and dependency validation
- ✅ Integration: Full CRUD operations with real database (14 tests)
- Run unit tests during development - They're fast and catch logic errors
- Run integration tests before commits - They verify end-to-end functionality
- Use unit tests for TDD - Write failing unit tests, then implement features
- Use integration tests for deployment validation - Verify database connectivity
This approach follows the Test Pyramid principle:
- Many fast unit tests (base of pyramid)
- Fewer comprehensive integration tests (top of pyramid)