Skip to content

test: cover factory generator edge cases#418

Merged
JerrettDavis merged 1 commit into
mainfrom
test/factories-generator-coverage-413
May 29, 2026
Merged

test: cover factory generator edge cases#418
JerrettDavis merged 1 commit into
mainfrom
test/factories-generator-coverage-413

Conversation

@JerrettDavis

Copy link
Copy Markdown
Owner

Summary

  • adds TinyBDD factory generator scenarios for empty hosts, default method validation, duplicate string/null keys, abstract creator products, and multi-base creator ambiguity
  • covers async string default factory branches and async-only factory-class creation fallback
  • extends internal factory helper assertions for unknown enum literals, null key compatibility, and accessibility formatting
  • continues Raise source-generator coverage toward 99% #413

Coverage

  • FactoriesGenerator uncovered lines dropped from 48 to 19 in the generator-only maintained-source report
  • Generator-only line coverage moved from 94.4% to 94.5%

Validation

  • dotnet test test/PatternKit.Generators.Tests/PatternKit.Generators.Tests.csproj --configuration Release --framework net10.0 --filter "FullyQualifiedName~FactoriesGeneratorTests" --logger "console;verbosity=minimal"
  • dotnet test test/PatternKit.Generators.Tests/PatternKit.Generators.Tests.csproj --configuration Release --no-restore -p:TestTfmsInParallel=false --collect:"XPlat Code Coverage" --results-directory ./TestResults --logger "console;verbosity=minimal" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=cobertura
  • dotnet format PatternKit.slnx --verify-no-changes --verbosity minimal

Copilot AI review requested due to automatic review settings May 29, 2026 03:05
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Deprecation Warning: The deny-licenses option is deprecated for possible removal in the next major release. For more information, see issue 997.

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 expands the generator test suite to cover additional edge cases and previously-uncovered branches in FactoriesGenerator, supporting the coverage goals in #413.

Changes:

  • Adds new TinyBDD scenarios for FactoryMethod edge cases (empty hosts, default validation, duplicate/null keys, signature mismatch).
  • Adds new TinyBDD scenarios for FactoryClass edge cases (abstract products, multi-base ambiguity, async factory creation fallback).
  • Extends internal helper assertions (unknown enum literals, null-key compatibility, accessibility formatting, async return formatting).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +335 to +337
[Scenario("FactoryMethod ValidatesDefaultsAndStringKeyComparer")]
[Fact]
public void FactoryMethod_ValidatesDefaultsAndStringKeyComparer()
Comment on lines +575 to +577
[Scenario("FactoryClass FlagsAbstractProductAndMultipleBases")]
[Fact]
public void FactoryClass_FlagsAbstractProductAndMultipleBases()
@github-actions

Copy link
Copy Markdown
Contributor

Code Coverage

Summary
  Generated on: 05/29/2026 - 03:12:20
  Coverage date: 05/29/2026 - 03:10:09 - 05/29/2026 - 03:12:08
  Parser: MultiReport (12x Cobertura)
  Assemblies: 5
  Classes: 1616
  Files: 551
  Line coverage: 95.4%
  Covered lines: 42161
  Uncovered lines: 2022
  Coverable lines: 44183
  Total lines: 95379
  Branch coverage: 76.7% (12459 of 16223)
  Covered branches: 12459
  Total branches: 16223
  Method coverage: 96.4% (8351 of 8658)
  Full method coverage: 88.9% (7701 of 8658)
  Covered methods: 8351
  Fully covered methods: 7701
  Total methods: 8658

PatternKit.Core                                                                                                     95.4%
  PatternKit.Application.ActivityTracking.ActivityGateState                                                          100%
  PatternKit.Application.ActivityTracking.ActivityLease                                                              100%
  PatternKit.Application.ActivityTracking.ActivityRecord                                                             100%
  PatternKit.Application.ActivityTracking.ActivityTracker                                                            100%
  PatternKit.Application.Aggregates.AggregateCommandHandler<T1, T2, T3>                                              100%
  PatternKit.Application.Aggregates.AggregateCommandResult<T>                                                        100%
  PatternKit.Application.Aggregates.AggregateRoot<T1, T2>                                                            100%
  PatternKit.Application.AntiCorruption.AntiCorruptionLayer<T1, T2>                                                 90.4%
  PatternKit.Application.AntiCorruption.AntiCorruptionResult<T>                                                      100%
  PatternKit.Application.AuditLog.AuditLogAppendResult<T>                                                           85.7%
  PatternKit.Application.AuditLog.InMemoryAuditLog<T1, T2>                                                          95.4%
  PatternKit.Application.BoundedContexts.BoundedContextAdapter                                                       100%
  PatternKit.Application.BoundedContexts.BoundedContextCapability                                                   83.3%
  PatternKit.Application.BoundedContexts.BoundedContextDescriptor                                                   95.4%
  PatternKit.Application.ContextMaps.ContextMapDescriptor                                                           96.8%
  PatternKit.Application.ContextMaps.ContextMapRelationship                                                          100%
  PatternKit.Application.DataMapping.DataMapper<T1, T2>                                                             94.6%
  PatternKit.Application.DataMapping.DataMapperError                                                                  90%
  PatternKit.Application.DataMapping.DataMapperResult<T>                                                            84.6%
  PatternKit.Application.DomainEvents.DomainEventDispatcher<T>                                                      95.4%
  PatternKit.Application.DomainEvents.DomainEventDispatchResult                                                      100%
  PatternKit.Application.DomainServices.DomainServiceOperation<T1, T2>                                               100%
  PatternKit.Application.DomainServices.DomainServiceRegistry<T1, T2>                                                100%
  PatternKit.Application.EventSourcing.EventStoreAppendResult                                                        100%
  PatternKit.Application.EventSourcing.InMemoryEventStore<T1, T2>                                                   97.9%
  PatternKit.Application.EventSourcing.StoredEvent<T1, T2>                                                            80%
  PatternKit.Application.FeatureToggles.FeatureToggleDecision                                                       87.5%
  PatternKit.Application.FeatureToggles.FeatureToggleRule<T>                                                         100%
  PatternKit.Application.FeatureToggles.FeatureToggleSet<T>                                                         96.9%
  PatternKit.Application.IdentityMap.IdentityMap<T1, T2>                                                             100%
  PatternKit.Application.IdentityMap.IdentityMapResult<T>                                                           92.8%
  PatternKit.Application.MaterializedViews.MaterializedView<T1, T2>                                                 98.4%
  PatternKit.Application.Repository.InMemoryRepository<T1, T2>                                                      92.8%
  PatternKit.Application.Repository.RepositoryResult<T>                                                             93.3%
  PatternKit.Application.ServiceLayer.ServiceLayerOperation<T1, T2>                                                 96.7%
  PatternKit.Application.ServiceLayer.ServiceLayerResult<T>                                                         94.7%
  PatternKit.Application.ServiceLayer.ServiceLayerRule<T>                                                            100%
  PatternKit.Application.Specification.Specification<T>                                                              100%

@github-actions

Copy link
Copy Markdown
Contributor

Test Results

    12 files      12 suites   10m 3s ⏱️
 3 605 tests  3 605 ✅ 0 💤 0 ❌
10 826 runs  10 826 ✅ 0 💤 0 ❌

Results for commit e352cb2.

@github-actions

Copy link
Copy Markdown
Contributor

🔍 PR Validation Results

Version: ``

✅ Validation Steps

  • Build solution
  • Run tests
  • Build documentation
  • Dry-run NuGet packaging

📊 Artifacts

Dry-run artifacts have been uploaded and will be available for 7 days.


This comment was automatically generated by the PR validation workflow.

@codecov

codecov Bot commented May 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.75%. Comparing base (596fdc7) to head (e352cb2).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #418      +/-   ##
==========================================
+ Coverage   89.65%   95.75%   +6.09%     
==========================================
  Files         551      551              
  Lines       44183    44183              
  Branches     6357     6357              
==========================================
+ Hits        39614    42306    +2692     
+ Misses       2048     1877     -171     
+ Partials     2521        0    -2521     
Flag Coverage Δ
unittests 95.75% <ø> (+6.09%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@JerrettDavis JerrettDavis merged commit 3710e2a into main May 29, 2026
13 checks passed
@JerrettDavis JerrettDavis deleted the test/factories-generator-coverage-413 branch May 29, 2026 03:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants