test: cover dynamic router and durable subscriber generators#433
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
There was a problem hiding this comment.
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.
| 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(")"); | ||
|
|
| 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); | ||
| } |
| 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); |
Test Results 12 files 12 suites 9m 41s ⏱️ Results for commit edc2c72. ♻️ This comment has been updated with latest results. |
Codecov Report❌ Patch coverage is
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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🔍 PR Validation ResultsVersion: `` ✅ Validation Steps
📊 ArtifactsDry-run artifacts have been uploaded and will be available for 7 days. This comment was automatically generated by the PR validation workflow. |
dd1ce9d to
edc2c72
Compare
Code Coverage |
Summary
Validation
DynamicRouterGeneratorTests|FullyQualifiedNameDurableSubscriberGeneratorTests|FullyQualifiedName~AbstractionsAttributeCoverageTests" --logger "console;verbosity=minimal"Coverage: DynamicRouterGenerator 97.9%; DurableSubscriberGenerator 97.1%; GenerateDynamicRouterAttribute/DynamicRouteAttribute/GenerateDurableSubscriberAttribute/DurableSubscriberHandlerAttribute 100%; PatternKit.Generators 95.6% locally.