test(generators): cover domain events and sidecar#437
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 increases source-generator coverage (refs #413) by expanding TinyBDD scenarios for the Domain Event Dispatcher and Sidecar generators, and by validating that generated output compiles (EmitSuccess), including new nested-host wrapper generation paths.
Changes:
- Add nested containing-type wrapper emission to the Sidecar and Domain Event Dispatcher generators.
- Expand generator test matrices for invalid signatures/declarations, defaults, host shapes, escaped names, malformed type arguments, and nested hosts.
- Update tests to emit/compile the post-generator compilation and assert
EmitSuccess(in addition to source inspection).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/PatternKit.Generators/Sidecar/SidecarGenerator.cs | Generates nested containing-type wrappers when the sidecar host is nested. |
| src/PatternKit.Generators/DomainEvents/DomainEventDispatcherGenerator.cs | Generates nested containing-type wrappers when the dispatcher host is nested. |
| test/PatternKit.Generators.Tests/SidecarGeneratorTests.cs | Adds Theory-based invalid-case coverage + new scenarios for defaults/host shapes, nested wrappers, malformed type args; asserts emit success. |
| test/PatternKit.Generators.Tests/DomainEventDispatcherGeneratorTests.cs | Expands invalid signature coverage + new scenarios for defaults/host shapes, nested wrappers, malformed type args; asserts emit success. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| var containingTypes = GetContainingTypes(type); | ||
| var indentLevel = 0; | ||
| foreach (var containingType in containingTypes) | ||
| { | ||
| AppendTypeDeclaration(sb, containingType, indentLevel); | ||
| sb.AppendLine(); | ||
| sb.AppendLine(new string(' ', indentLevel * 4) + "{"); | ||
| indentLevel++; | ||
| } |
|
|
||
| sb.Append(GetAccessibility(type.DeclaredAccessibility)).Append(' '); | ||
| if (type.IsStatic) | ||
| sb.Append("static "); | ||
| 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).AppendLine(); | ||
| sb.AppendLine("{"); | ||
| sb.Append(" public static global::PatternKit.Application.DomainEvents.DomainEventDispatcher<") | ||
| var containingTypes = GetContainingTypes(type); | ||
| var indentLevel = 0; | ||
| foreach (var containingType in containingTypes) | ||
| { | ||
| AppendTypeDeclaration(sb, containingType, indentLevel); | ||
| sb.AppendLine(); | ||
| sb.AppendLine(new string(' ', indentLevel * 4) + "{"); | ||
| indentLevel++; | ||
| } | ||
|
|
Code Coverage |
Test Results 12 files 12 suites 9m 23s ⏱️ Results for commit b38ee70. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #437 +/- ##
==========================================
+ Coverage 90.86% 96.44% +5.57%
==========================================
Files 551 551
Lines 44587 44627 +40
Branches 6420 6426 +6
==========================================
+ Hits 40516 43042 +2526
+ Misses 1707 1585 -122
+ Partials 2364 0 -2364
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. |
Summary
Validation
DomainEventDispatcherGeneratorTests|FullyQualifiedNameSidecarGeneratorTests" --logger "console;verbosity=minimal"Coverage
Refs #413