Skip to content

Latest commit

 

History

History
306 lines (239 loc) · 8.26 KB

File metadata and controls

306 lines (239 loc) · 8.26 KB

Code Coverage Assessment Report

PanoramicData.NCalcExtensions

Date: October 31, 2025
Version: 5.7-alpha
Total Tests: 933 (931 passing, 2 known failures)


?? Overall Coverage Summary

Metric Value Status
Line Coverage 78.2% ?? Good, but needs improvement
Branch Coverage 71.7% ?? Needs improvement
Covered Lines 2,044 ?
Uncovered Lines 567 ?? Need attention
Coverable Lines 2,611 -
Branches Covered 1,697 / 2,366 ??

?? Coverage Goals

Goal Current Target Gap
Line Coverage 78.2% 90%+ -11.8%
Branch Coverage 71.7% 85%+ -13.3%

?? Critical Coverage Gaps (0% Coverage)

These classes have ZERO test coverage and should be prioritized:

1. ListHelpers - 0% Coverage

  • File: Extensions/ListHelpers.cs
  • Purpose: List manipulation helper (Collapse method)
  • Risk: HIGH - Used internally by list operations
  • Action Required: ? Add unit tests for Collapse() method

2. LambdaFunction - 0% Coverage

  • File: Extensions/Lambda.cs
  • Purpose: Lambda function creation from parameters
  • Risk: HIGH - Core functionality for dynamic expressions
  • Action Required: ? Add unit tests for lambda parameter handling

3. LastIndexOf - 0% Coverage

  • File: Extensions/LastIndexOf.cs
  • Purpose: Find last occurrence of string
  • Risk: MEDIUM - String search functionality
  • Action Required: ? Add unit tests (similar to IndexOf which has 100%)

4. TypeHelper - 0% Coverage

  • File: Helpers/TypeHelper.cs
  • Purpose: Type conversion and manipulation utilities
  • Risk: HIGH - Utility class used across the project
  • Action Required: ? Add comprehensive unit tests

?? Low Coverage Areas (<65%)

Critical Priority (0-50%)

  1. Parameters - 16% - Extension parameter handling
  2. Max - 50.5% - Maximum value calculation
  3. Min - 50.5% - Minimum value calculation
  4. ObjectKeyComparer - 56% - Sorting comparison logic
  5. CountBy - 56.2% - Grouping and counting operations
  6. Sum - 59% - Summing numeric values

Medium Priority (50-65%)

  1. IsNaN - 61.1% - NaN checking
  2. In - 61.5% - Value in set checking
  3. TimeSpanExtensions - 62.5% - TimeSpan helpers
  4. If - 62.9% - Conditional expressions
  5. DateTimeIsInPast - 63.6% - DateTime comparisons
  6. DateTimeIsInFuture - 63.6% - DateTime comparisons
  7. Substring - 65% - String manipulation
  8. ListOf - 65.3% - Typed list creation
  9. ToString - 65.6% - String conversion
  10. Humanize - 65.7% - Human-readable formatting

? Excellent Coverage (100%)

These classes have complete coverage:

  1. All - 100%
  2. Any - 100%
  3. Capitalize - 100%
  4. Cast - 100%
  5. ChangeTimeZone - 100%
  6. Concat - 100%
  7. Contains - 100%
  8. Distinct - 100%
  9. EndsWith - 100%
  10. GetProperties - 100%
  11. IndexOf - 100%
  12. IsGuid - 100%
  13. IsNull - 100%
  14. IsNullOrEmpty - 100%
  15. IsNullOrWhiteSpace - 100%
  16. IsSet - 100%
  17. ItemAtIndex - 100%
  18. Join - 100%
  19. Length - 100%
  20. NewJArray - 100%
  21. NewJsonArray - 100%
  22. NullCoalesce - 100%
  23. OrderBy - 100%
  24. RegexIsMatch - 100%
  25. Retrieve - 100%
  26. Reverse - 100%
  27. SelectDistinct - 100%
  28. Split - 100%
  29. Store - 100%
  30. Switch - 100%
  31. Throw - 100%
  32. Try - 100%
  33. TypeOf - 100%
  34. Where - 100%
  35. StringExtensions - 100%

Total: 35 classes with 100% coverage ?


?? Action Plan to Reach 90% Coverage

Phase 1: Fix Critical Gaps (0% Coverage) - HIGH PRIORITY

1. Add Tests for ListHelpers (Estimated: 30 min)

// Required tests:
- Collapse_EmptyList_ReturnsEmpty()
- Collapse_FlatList_ReturnsSame()
- Collapse_NestedList_Flattens()
- Collapse_DeeplyNested_CollapsesAll()
- Collapse_MixedTypes_HandlesCorrectly()

2. Add Tests for LambdaFunction (Estimated: 45 min)

// Required tests:
- Lambda_ValidParameters_CreatesLambda()
- Lambda_NullPredicate_ThrowsException()
- Lambda_NullExpression_ThrowsException()
- Lambda_InvalidParameters_ThrowsException()

3. Add Tests for LastIndexOf (Estimated: 30 min)

// Required tests:
- LastIndexOf_Found_ReturnsCorrectIndex()
- LastIndexOf_NotFound_ReturnsMinusOne()
- LastIndexOf_MultipleOccurrences_ReturnsLast()
- LastIndexOf_EmptyStrings_HandlesCorrectly()
- LastIndexOf_NullParameters_ThrowsException()

4. Add Tests for TypeHelper (Estimated: 1 hour)

// Required tests:
- AsHumanString_VariousTypes_ReturnsReadable()
- TypeConversion_ValidTypes_Succeeds()
- TypeConversion_InvalidTypes_Fails()

Estimated Time for Phase 1: 2.5 hours
Expected Coverage Gain: +5-7%


Phase 2: Improve Low Coverage Areas (<65%) - MEDIUM PRIORITY

Priority Order:

  1. Parameters (16%) - Add comprehensive parameter handling tests
  2. Max/Min (50.5%) - Add edge case tests (nulls, empty lists, single items)
  3. CountBy (56.2%) - Add tests for various grouping scenarios
  4. Sum (59%) - Add tests for different numeric types and edge cases
  5. If (62.9%) - Add tests for all conditional branches
  6. DateTime comparisons (63.6%) - Add timezone and edge case tests
  7. Substring (65%) - Add boundary condition tests

Estimated Time for Phase 2: 4-6 hours
Expected Coverage Gain: +8-10%


Phase 3: Branch Coverage Improvement - MEDIUM PRIORITY

Focus on increasing branch coverage from 71.7% to 85%+:

  1. Add tests for error conditions in all functions
  2. Test all switch statement branches
  3. Test all if/else branches
  4. Test exception handling paths
  5. Test null handling branches
  6. Test type checking branches

Estimated Time for Phase 3: 3-4 hours
Expected Coverage Gain: +10-13% branch coverage


?? Coverage Improvement Roadmap

Week 1: Critical Fixes

  • ? Add tests for 0% coverage classes
  • Target: 85% line coverage

Week 2: Branch Coverage

  • ? Add error path tests
  • ? Add edge case tests
  • Target: 85% branch coverage

Week 3: Comprehensive Coverage

  • ? Add integration tests
  • ? Add performance edge cases
  • Target: 90%+ line coverage, 85%+ branch coverage

??? Tools & Configuration

Coverage Collection

<PackageReference Include="coverlet.collector" Version="6.0.4" />

Generate Reports

dotnet test --collect:"XPlat Code Coverage"
reportgenerator -reports:"TestResults/**/coverage.cobertura.xml" -targetdir:"CoverageReport"

CI/CD Integration

Add to build pipeline:

  • Collect coverage on every build
  • Fail build if coverage drops below threshold
  • Generate coverage badge for README

?? Recommended Coverage Thresholds

Add to project file:

<PropertyGroup>
  <CoverletOutputFormat>cobertura</CoverletOutputFormat>
  <Threshold>90</Threshold>
  <ThresholdType>line</ThresholdType>
  <ThresholdStat>total</ThresholdStat>
</PropertyGroup>

?? Current Status Summary

Category Count Percentage
Excellent (90-100%) 35 classes 44%
Good (75-89%) 20 classes 25%
Needs Work (50-74%) 21 classes 26%
Critical (<50%) 4 classes 5%

? Next Immediate Actions

  1. TODAY: Create tests for 4 classes with 0% coverage
    • ListHelpers
  • LambdaFunction
    • LastIndexOf
    • TypeHelper
  1. THIS WEEK: Improve coverage for classes below 65%

    • Focus on Parameters, Max, Min, Sum
  2. NEXT WEEK: Add comprehensive branch coverage tests

    • Error paths
    • Edge cases
    • Exception scenarios
  3. ONGOING: Maintain 90%+ coverage

    • Add tests with new features
    • Monitor coverage in CI/CD
  • Enforce coverage thresholds

?? Recommendations

  1. ? Enable Coverage Checks in CI/CD - Fail builds if coverage drops
  2. ? Set Minimum Threshold - Require 85% line + 80% branch coverage
  3. ? Add Coverage Badge - Show coverage status in README
  4. ? Review Coverage Weekly - Track improvements over time
  5. ? Test-First Development - Write tests before code for new features

Report Generated: October 31, 2025
Next Review: November 7, 2025 (after Phase 1 completion)