Increase code coverage for PathHelpers and Validation#54
Conversation
Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
| // SOFTWARE. | ||
|
|
||
| using DemaConsulting.BuildMark.RepoConnectors; | ||
| using NSubstitute; |
There was a problem hiding this comment.
Is this change needed - it's the only change in the file.
There was a problem hiding this comment.
Removed in commit 25322e8. The using statement was added during test development but ended up not being needed.
| @@ -0,0 +1,176 @@ | |||
| // Copyright (c) DEMA Consulting | |||
There was a problem hiding this comment.
Please examine https://github.com/demaconsulting/SarifMark/blob/main/test/DemaConsulting.SarifMark.Tests/PathHelpersTests.cs which tests SafePathCombine but doesn't need to do the inconclusive tests for different operating systems. Please use its approach instead.
There was a problem hiding this comment.
Refactored in commit 25322e8 to use the cleaner Assert.Throws pattern from SarifMark. Combined Unix/Windows absolute path tests into a single method with conditional Windows check, eliminating the need for inconclusive tests.
Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
…ompliance, macOS support, CodeQL build-mode Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
* Initial plan * Apply TemplateDotNetTool changes from PRs #53, #54, #55: Continuous Compliance, macOS support, CodeQL build-mode Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Pull Request
Description
Adds unit tests for under-tested utility methods to increase code coverage:
Coverage Improvements
PathHelpers.SafePathCombine: 66.7% → 100%
Validation.WriteResultsFile: 0% → 93.8%
Test Files Added
PathHelpersTests.cs- 4 tests for path security validation using Assert.Throws patternValidationTests.cs- 4 tests for results file generationGitHubRepoConnector Methods Not Covered
BuildLookupData, DetermineTargetVersion, and related baseline methods were not unit tested. These methods have complex Octokit type dependencies (Release, RepositoryTag, etc.) that are immutable DTOs unsuitable for mocking. They are already covered by integration tests in BuildInformationTests.cs.
Code Review Updates
using NSubstitute;statement from GitHubRepoConnectorTests.csType of Change
Related Issues
Pre-Submission Checklist
Before submitting this pull request, ensure you have completed the following:
Build and Test
dotnet build --configuration Releasedotnet test --configuration ReleaseCode Quality
dotnet format --verify-no-changesQuality Checks
Please run the following checks before submitting:
cspell "**/*.{md,cs}"markdownlint "**/*.md"yamllint '**/*.{yml,yaml}'Testing
Documentation
Additional Notes
Total test count is 127 (increased from 119). Tests use the Assert.Throws pattern for cleaner exception validation. Windows-specific path tests run conditionally using
OperatingSystem.IsWindows()without requiring skipped tests. CodeQL scan shows zero security alerts.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.