- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1
Significantly improve code coverage by adding comprehensive test suite for extension methods #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
Conversation
…ing methods Co-authored-by: eNeRGy164 <10671831+eNeRGy164@users.noreply.github.com>
Co-authored-by: eNeRGy164 <10671831+eNeRGy164@users.noreply.github.com>
| Pull Request Test Coverage Report for Build 15926884347Details
 
 💛 - Coveralls | 
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 PR significantly improves code coverage by introducing 49 new tests that cover public extension methods, ensuring robust null checks, boundary conditions, and complex scenarios.
- Added tests for string manipulation, generic type handling, and case sensitivity.
- Covered recursive traversal, invocation matching, and consequence extraction in extension methods.
- Enhanced tests for methods First and FirstOrDefault along with various edge cases.
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description | 
|---|---|
| tests/DendroDocs.Client.Tests/Extensions/StringExtensionsTests.EdgeCases.cs | Adds tests for string formatting and generic type evaluation. | 
| tests/DendroDocs.Client.Tests/Extensions/InvocationDescriptionExtensionsTests.EdgeCases.cs | Covers case sensitivity and parameter matching in invocation extensions. | 
| tests/DendroDocs.Client.Tests/Extensions/IEnumerableTypeDescriptionExtensionsTests.TraverseStatement.cs | Tests recursive traversal with Switch and If statement scenarios. | 
| tests/DendroDocs.Client.Tests/Extensions/IEnumerableTypeDescriptionExtensionsTests.GetInvokedMethod.cs | Validates method retrieval based on type and method names. | 
| tests/DendroDocs.Client.Tests/Extensions/IEnumerableTypeDescriptionExtensionsTests.GetInvocationConsequences.cs | Ensures correct extraction of invocation consequences and nested invocations. | 
| tests/DendroDocs.Client.Tests/Extensions/IEnumerableTypeDescriptionExtensionsTests.GetInvocationConsequenceStatements.cs | Tests inclusion of both invocation and non-invocation statements. | 
| tests/DendroDocs.Client.Tests/Extensions/IEnumerableTypeDescriptionExtensionsTests.FirstOrDefault.cs | Checks correct return of the first matching type or null when not found. | 
| tests/DendroDocs.Client.Tests/Extensions/IEnumerableTypeDescriptionExtensionsTests.First.cs | Verifies the behavior of the First method including exception throwing for missing types. | 
| tests/DendroDocs.Client.Tests/Extensions/IEnumerableTypeDescriptionExtensionsTests.EdgeCases.cs | Adds various edge cases such as case sensitivity and nested switch/if scenarios. | 
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.
Instead of seperate "EdgeCase" files, combine methods in their respective method scoped files.
Co-authored-by: eNeRGy164 <10671831+eNeRGy164@users.noreply.github.com>
| 
 Done! I've consolidated all edge case tests from the separate EdgeCase files into their respective method-scoped files and removed the EdgeCase files. All 135 tests are still passing. The changes are in commit c629636. | 
This PR addresses the low code coverage issue by adding 49 new tests, increasing the test count from 86 to 135 tests (+57% increase).
Problem
The repository had low code coverage due to several public extension methods lacking any test coverage, particularly in
IEnumerableTypeDescriptionExtensions.Solution
Added comprehensive test coverage for all previously untested public methods:
New Test Files Created
IEnumerableTypeDescriptionExtensionsTests.First.cs(4 tests)IEnumerableTypeDescriptionExtensionsTests.FirstOrDefault.cs(4 tests)IEnumerableTypeDescriptionExtensionsTests.GetInvokedMethod.cs(5 tests)IEnumerableTypeDescriptionExtensionsTests.GetInvocationConsequences.cs(5 tests)IEnumerableTypeDescriptionExtensionsTests.GetInvocationConsequenceStatements.cs(5 tests)IEnumerableTypeDescriptionExtensionsTests.TraverseStatement.cs(5 tests)Edge Case Test Files
StringExtensionsTests.EdgeCases.cs(10 additional tests)InvocationDescriptionExtensionsTests.EdgeCases.cs(5 additional tests)IEnumerableTypeDescriptionExtensionsTests.EdgeCases.cs(6 additional tests)Test Coverage Areas
✅ Null reference protection - All methods properly validate null inputs
✅ Empty collection handling - Proper behavior with empty sequences
✅ Case sensitivity validation - Ensures ordinal string comparisons work correctly
✅ Parameter matching - Complex scenarios with optional parameters
✅ Recursive traversal - Statement traversal with nested structures
✅ Boundary conditions - Edge cases like single characters, special characters
Key Methods Now Covered
Previously untested public methods that now have full coverage:
First(IEnumerable<TypeDescription>, string)FirstOrDefault(IEnumerable<TypeDescription>, string)GetInvokedMethod(IEnumerable<TypeDescription>, InvocationDescription)GetInvocationConsequences(IEnumerable<TypeDescription>, InvocationDescription)GetInvocationConsequenceStatements(IEnumerable<TypeDescription>, InvocationDescription)TraverseStatement(IEnumerable<TypeDescription>, Statement)Validation
All 135 tests pass with no failures, ensuring the new tests are robust and the existing functionality remains intact.
Fixes #5.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.