-
Notifications
You must be signed in to change notification settings - Fork 0
Add tests #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tests #6
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request significantly expands test coverage across the ProjGraph solution by adding comprehensive unit, integration, and contract tests. The changes also include improved error handling in the GraphService and removal of the legacy .sln file in favor of the .slnx format.
Changes:
- Added extensive unit tests for parsers, renderers, models, algorithms, and services
- Added integration tests for CLI commands and MCP tools with helper utilities
- Enhanced contract tests with more detailed assertions
- Improved error handling by adding FileNotFoundException check in GraphService
- Removed ProjGraph.sln file (likely moving to .slnx exclusively)
Reviewed changes
Copilot reviewed 21 out of 22 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/ProjGraph.Tests.Unit/Services/GraphServiceTests.cs | Added tests for error cases and edge conditions; removed platform-specific skip logic |
| tests/ProjGraph.Tests.Unit/Services/EfAnalysisServiceTests.cs | Added comprehensive tests for Entity Framework analysis edge cases |
| tests/ProjGraph.Tests.Unit/Rendering/MermaidGraphRendererTests.cs | New file with complete test coverage for Mermaid graph rendering |
| tests/ProjGraph.Tests.Unit/Rendering/MermaidErdRendererTests.cs | New file with complete test coverage for Mermaid ERD rendering |
| tests/ProjGraph.Tests.Unit/Parsers/SlnxParserTests.cs | Added tests for edge cases and cross-platform path handling |
| tests/ProjGraph.Tests.Unit/Parsers/SlnParserTests.cs | Minor code style improvement (const instead of var) |
| tests/ProjGraph.Tests.Unit/Parsers/ProjectParserTests.cs | Added tests for project parsing edge cases; unified path separators to forward slashes |
| tests/ProjGraph.Tests.Unit/Models/SolutionGraphTests.cs | New file with tests for SolutionGraph model behavior |
| tests/ProjGraph.Tests.Unit/Models/ProjectTests.cs | New file with tests for Project model behavior |
| tests/ProjGraph.Tests.Unit/Models/DependencyTests.cs | New file with tests for Dependency model behavior |
| tests/ProjGraph.Tests.Unit/Algorithms/TarjanSccAlgorithmTests.cs | Added tests for algorithm edge cases including self-loops and complex graphs |
| tests/ProjGraph.Tests.Unit/ProjGraph.Tests.Unit.csproj | Formatting change removing spaces before self-closing tags |
| tests/ProjGraph.Tests.Integration/Mcp/McpIntegrationTests.cs | Refactored tests with helper methods and added comprehensive test scenarios |
| tests/ProjGraph.Tests.Integration/Mcp/McpErdTests.cs | Added extensive ERD integration tests including error handling |
| tests/ProjGraph.Tests.Integration/Cli/VisualizeCommandTests.cs | New file with CLI visualization command tests |
| tests/ProjGraph.Tests.Integration/Cli/ErdCommandTests.cs | New file with CLI ERD command tests |
| tests/ProjGraph.Tests.Integration/Cli/CliTestHelpers.cs | New helper utilities for CLI testing |
| tests/ProjGraph.Tests.Integration/Cli/CliIntegrationTests.cs | Deleted file (functionality moved to separate command test files) |
| tests/ProjGraph.Tests.Contract/McpErdContractTests.cs | Enhanced with more detailed attribute and parameter validation |
| tests/ProjGraph.Tests.Contract/McpContractTests.cs | Enhanced with more detailed attribute and parameter validation |
| src/ProjGraph.Lib/Services/GraphService.cs | Added FileNotFoundException check for improved error handling |
| ProjGraph.sln | Deleted legacy solution file |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| { | ||
| // Arrange | ||
| var tools = CreateTools(); | ||
| const string nonExistentPath = @"C:\this\path\does\not\exist.cs"; |
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hard-coded Windows path in non-Windows specific test. The path "C:\this\path\does\not\exist.cs" will fail on non-Windows systems. Use Path.Combine or Path.GetTempPath() with subdirectories instead to ensure cross-platform compatibility.
| const string nonExistentPath = @"C:\this\path\does\not\exist.cs"; | |
| var nonExistentPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString("N") + ".cs"); | |
| if (File.Exists(nonExistentPath)) | |
| { | |
| File.Delete(nonExistentPath); | |
| } |
| var output = new StringBuilder(); | ||
| var originalOut = Console.Out; | ||
| var originalError = Console.Error; | ||
| var writer = new StringWriter(output); |
Copilot
AI
Jan 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This variable is manually disposed in a finally block - consider a C# using statement as a preferable resource management technique.
…mprove path handling in GraphService
…platform compatibility
No description provided.