Skip to content

test: cover dynamic router and durable subscriber generators#433

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

test: cover dynamic router and durable subscriber generators#433
JerrettDavis merged 1 commit into
mainfrom
test/messaging-router-subscriber-generator-coverage-413

Conversation

@JerrettDavis

Copy link
Copy Markdown
Owner

Summary

  • emit containing partial type wrappers for nested Dynamic Router and Durable Subscriber generator hosts
  • convert Dynamic Router and Durable Subscriber generator tests to TinyBDD xUnit scenarios
  • cover invalid signatures, duplicate routes, malformed type arguments, host shape preservation, emitted compilation, and missing messaging attribute constructors

Validation

  • dotnet test test/PatternKit.Generators.Tests/PatternKit.Generators.Tests.csproj --configuration Release --framework net10.0 --filter "FullyQualifiedNameDynamicRouterGeneratorTests|FullyQualifiedNameDurableSubscriberGeneratorTests|FullyQualifiedName~AbstractionsAttributeCoverageTests" --logger "console;verbosity=minimal"
  • dotnet test test/PatternKit.Generators.Tests/PatternKit.Generators.Tests.csproj --configuration Release -p:TestTfmsInParallel=false --collect:"XPlat Code Coverage" --results-directory ./TestResults --logger "console;verbosity=minimal" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=cobertura
  • reportgenerator -reports:TestResults/**/coverage.cobertura.xml -targetdir:coverage-report-generators -reporttypes:TextSummary
  • dotnet format PatternKit.slnx --verify-no-changes --verbosity minimal
  • dotnet test test/PatternKit.Generators.Tests/PatternKit.Generators.Tests.csproj --configuration Release --no-restore --no-build -p:TestTfmsInParallel=false --logger "console;verbosity=minimal"

Coverage: DynamicRouterGenerator 97.9%; DurableSubscriberGenerator 97.1%; GenerateDynamicRouterAttribute/DynamicRouteAttribute/GenerateDurableSubscriberAttribute/DurableSubscriberHandlerAttribute 100%; PatternKit.Generators 95.6% locally.

@github-actions

github-actions Bot commented May 29, 2026

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 coverage for the Messaging source generators by converting the Dynamic Router and Durable Subscriber generator tests to TinyBDD xUnit scenarios and adding scenarios for nested generator hosts (via containing-type wrapper emission) and additional invalid-declaration cases.

Changes:

  • Update Dynamic Router and Durable Subscriber generators to emit containing partial type wrappers for nested generator hosts.
  • Convert Dynamic Router and Durable Subscriber generator tests to TinyBDD xUnit scenario style and broaden diagnostic/shape/emit coverage.
  • Extend abstractions attribute coverage to include new router/subscriber-related attributes and their constructor validation.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/PatternKit.Generators/Messaging/DynamicRouterGenerator.cs Emits generated factory inside containing partial type wrappers for nested hosts.
src/PatternKit.Generators/Messaging/DurableSubscriberGenerator.cs Same containing-type wrapper emission for durable subscriber factories.
test/PatternKit.Generators.Tests/DynamicRouterGeneratorTests.cs Migrates to TinyBDD scenarios and adds coverage for invalid declarations, host shapes, nesting, and malformed type args.
test/PatternKit.Generators.Tests/DurableSubscriberGeneratorTests.cs Migrates to TinyBDD scenarios and adds coverage for invalid declarations, defaults, host shapes, nesting, and malformed type args.
test/PatternKit.Generators.Tests/AbstractionsAttributeCoverageTests.cs Adds coverage for new messaging attributes’ defaults and constructor validation.

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

Comment on lines 251 to 253
foreach (var route in routes)
sb.Append(" .When(@\"").Append(route.Name).Append("\", ").Append(route.Order).Append(", ").Append(route.PredicateMethodName).Append(").Then(").Append(route.HandlerMethodName).AppendLine(")");
sb.Append(chainIndent).Append(" .When(@\"").Append(route.Name).Append("\", ").Append(route.Order).Append(", ").Append(route.PredicateMethodName).Append(").Then(").Append(route.HandlerMethodName).AppendLine(")");

Comment on lines +285 to +289
sb.Append("abstract ");
else if (type.IsSealed && type.TypeKind == TypeKind.Class)
sb.Append("sealed ");
sb.Append("partial ").Append(type.TypeKind == TypeKind.Struct ? "struct" : "class").Append(' ').Append(type.Name);
}
Comment on lines +146 to +150
else if (type.IsAbstract && type.TypeKind == TypeKind.Class)
sb.Append("abstract ");
else if (type.IsSealed && type.TypeKind == TypeKind.Class)
sb.Append("sealed ");
sb.Append("partial ").Append(type.TypeKind == TypeKind.Struct ? "struct" : "class").Append(' ').Append(type.Name);
@github-actions

github-actions Bot commented May 29, 2026

Copy link
Copy Markdown
Contributor

Test Results

    12 files      12 suites   9m 41s ⏱️
 3 681 tests  3 681 ✅ 0 💤 0 ❌
11 138 runs  11 138 ✅ 0 💤 0 ❌

Results for commit edc2c72.

♻️ This comment has been updated with latest results.

@codecov

codecov Bot commented May 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.80220% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.22%. Comparing base (a3fe0b9) to head (edc2c72).

Files with missing lines Patch % Lines
...Generators/Messaging/DurableSubscriberGenerator.cs 97.82% 1 Missing ⚠️
...Kit.Generators/Messaging/DynamicRouterGenerator.cs 97.77% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #433      +/-   ##
==========================================
+ Coverage   90.38%   96.22%   +5.83%     
==========================================
  Files         551      551              
  Lines       44392    44465      +73     
  Branches     6388     6402      +14     
==========================================
+ Hits        40124    42786    +2662     
+ Misses       1830     1679     -151     
+ Partials     2438        0    -2438     
Flag Coverage Δ
unittests 96.22% <97.80%> (+5.83%) ⬆️

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.

@github-actions

github-actions Bot commented May 29, 2026

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.

@JerrettDavis JerrettDavis force-pushed the test/messaging-router-subscriber-generator-coverage-413 branch from dd1ce9d to edc2c72 Compare May 29, 2026 20:54
@github-actions

Copy link
Copy Markdown
Contributor

Code Coverage

Summary
  Generated on: 05/29/2026 - 21:03:08
  Coverage date: 05/29/2026 - 21:00:33 - 05/29/2026 - 21:02:56
  Parser: MultiReport (12x Cobertura)
  Assemblies: 5
  Classes: 1616
  Files: 551
  Line coverage: 95.9%
  Covered lines: 42670
  Uncovered lines: 1795
  Coverable lines: 44465
  Total lines: 95858
  Branch coverage: 78.8% (12878 of 16333)
  Covered branches: 12878
  Total branches: 16333
  Method coverage: 96.6% (8391 of 8683)
  Full method coverage: 89.5% (7778 of 8683)
  Covered methods: 8391
  Fully covered methods: 7778
  Total methods: 8683

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%

@JerrettDavis JerrettDavis merged commit e905949 into main May 29, 2026
12 checks passed
@JerrettDavis JerrettDavis deleted the test/messaging-router-subscriber-generator-coverage-413 branch May 29, 2026 21:07
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