General Test Fixes - #387
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (9)
📝 WalkthroughWalkthroughThe generator now defaults to the latest major C# language version. Generator tests pass current parse and analyzer options, ignore a common generated file during verification, run across target frameworks, and update generated-output snapshots. ChangesGenerator test updates
Estimated code review effort: 3 (Moderate) | ~25 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
Coverage Report for CI Build 30656943911Coverage remained the same at 93.89%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/Immediate.Handlers.Generators/ImmediateHandlersGenerator.cs (1)
22-22: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd coverage for the empty-compilation fallback.
The
LanguageVersion.LatestMajorbranch runs only when the compilation has no usable syntax-tree options.GeneratorTestHelper.RunGeneratoralways parses the input source into a syntax tree. Add a test with an emptyCSharpCompilationand verify the generated output.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/Immediate.Handlers.Generators/ImmediateHandlersGenerator.cs` at line 22, Add test coverage for the LanguageVersion fallback in the generator setup by invoking the generator with an empty CSharpCompilation, without syntax trees or usable parse options. Use GeneratorTestHelper.RunGenerator or the relevant test entry point as appropriate, and assert the generated output to verify the LanguageVersion.LatestMajor path executes successfully.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@tests/Immediate.Handlers.Tests/GeneratorTests/ImmediateAssemblyIdentifierTests.cs`:
- Line 41: Preserve verification of common-file output at both call sites: in
tests/Immediate.Handlers.Tests/GeneratorTests/ImmediateAssemblyIdentifierTests.cs
lines 41-41, replace Utility.VerifyIgnoreCommonFile(result) with Verify(result)
or assert "Custom" in IH.ServiceCollectionExtensions.g.cs; in
tests/Immediate.Handlers.Tests/GeneratorTests/HandlerTests.cs lines 447-447,
likewise use Verify(result) or assert Tag1 and Tag2 in
IH.ServiceCollectionExtensions.g.cs.
---
Nitpick comments:
In `@src/Immediate.Handlers.Generators/ImmediateHandlersGenerator.cs`:
- Line 22: Add test coverage for the LanguageVersion fallback in the generator
setup by invoking the generator with an empty CSharpCompilation, without syntax
trees or usable parse options. Use GeneratorTestHelper.RunGenerator or the
relevant test entry point as appropriate, and assert the generated output to
verify the LanguageVersion.LatestMajor path executes successfully.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 74a77bf0-cd50-4453-8b86-36b8c14a73c4
📒 Files selected for processing (54)
src/Immediate.Handlers.Generators/ImmediateHandlersGenerator.cstests/Immediate.Handlers.Tests/GeneratorTests/AddHandlersTests.cstests/Immediate.Handlers.Tests/GeneratorTests/BehaviorTests.cstests/Immediate.Handlers.Tests/GeneratorTests/GeneratorTestHelper.cstests/Immediate.Handlers.Tests/GeneratorTests/HandlerTests.cstests/Immediate.Handlers.Tests/GeneratorTests/ImmediateAssemblyIdentifierTests.cstests/Immediate.Handlers.Tests/GeneratorTests/InvalidBehaviorsTests.cstests/Immediate.Handlers.Tests/GeneratorTests/InvalidHandlerTests.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/AddHandlersTests.ValidAddHandlerssMethod_framework=net10.0#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/AddHandlersTests.ValidAddHandlerssMethod_framework=net11.0#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/AddHandlersTests.ValidAddHandlerssMethod_framework=net8.0#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/AddHandlersTests.ValidAddHandlerssMethod_framework=net9.0#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/BehaviorTests.BehaviorHasMultipleTRequestConstraints#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/BehaviorTests.BehaviorHasMultipleTResponseConstraints#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/BehaviorTests.CrtpBehavior#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/BehaviorTests.MultipleBehaviors#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/BehaviorTests.NestedBehavior#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/BehaviorTests.NullableBehavior_behaviorNullable=False_returnNullable=False#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/BehaviorTests.NullableBehavior_behaviorNullable=False_returnNullable=True#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/BehaviorTests.NullableBehavior_behaviorNullable=True_returnNullable=False#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/BehaviorTests.NullableBehavior_behaviorNullable=True_returnNullable=True#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/BehaviorTests.RequestTypeParameterBehavior#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/BehaviorTests.ResponseTypeParameterBehavior#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/BehaviorTests.SingleBehavior#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/BehaviorTests.ZeroTypeParameterBehavior#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/HandlerTests.HandlerTags#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/HandlerTests.IntReturnType_modifier=static#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/HandlerTests.MissingCancellationToken_modifier=static#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/HandlerTests.MultipleParameterAttributes#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/HandlerTests.NullableParameterType#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/HandlerTests.NullableReturnType#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/HandlerTests.ServiceLifetime_lifetime=Scoped#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/HandlerTests.ServiceLifetime_lifetime=Singleton#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/HandlerTests.ServiceLifetime_lifetime=Transient#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/HandlerTests.SimpleParameterAttribute#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/HandlerTests.VoidReturnType_modifier=#IH.ServiceCollectionExtensions.g.verified.cs``tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/HandlerTests.VoidReturnType_modifier=static#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/ImmediateAssemblyIdentifierTests.ImmediateAssemblyIdentifierOverridesAssemblyName#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/InvalidBehaviorsTests.AbstractBehaviorShouldProduceNothing#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/InvalidBehaviorsTests.BehaviorHasTooManyTypeParametersShouldProduceNothing#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/InvalidBehaviorsTests.BoundGenericShouldProduceNothing#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/InvalidBehaviorsTests.NonBehaviorShouldProduceNothing#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/InvalidHandlerTests.HandlerWithNoParametersShouldProduceNothing#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/InvalidHandlerTests.HandlerWithTaskResponseShouldProduceNothing#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/InvalidHandlerTests.HandlerWithTwoHandlersMethodShouldProduceNothing#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/InvalidHandlerTests.HandlerWithVoidResponseShouldProduceNothing#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/InvalidHandlerTests.HandlerWithoutHandlerMethodShouldProduceNothing#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/InvalidHandlerTests.InstanceHandlerMethodWithTooManyParametersShouldProduceNothing#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/InvalidHandlerTests.NestedHandlerShouldProduceNothing#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/StreamingHandlerTests.StreamingBehavior#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/StreamingHandlerTests.StreamingIntReturnType_modifier=#IH.ServiceCollectionExtensions.g.verified.cs``tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/StreamingHandlerTests.StreamingIntReturnType_modifier=static#IH.ServiceCollectionExtensions.g.verified.cstests/Immediate.Handlers.Tests/GeneratorTests/StreamingHandlerTests.cstests/Immediate.Handlers.Tests/Utility.cs
💤 Files with no reviewable changes (40)
- tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/HandlerTests.NullableReturnType#IH.ServiceCollectionExtensions.g.verified.cs
- tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/HandlerTests.HandlerTags#IH.ServiceCollectionExtensions.g.verified.cs
- tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/HandlerTests.NullableParameterType#IH.ServiceCollectionExtensions.g.verified.cs
- tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/BehaviorTests.NullableBehavior_behaviorNullable=False_returnNullable=True#IH.ServiceCollectionExtensions.g.verified.cs
- tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/BehaviorTests.SingleBehavior#IH.ServiceCollectionExtensions.g.verified.cs
- tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/InvalidHandlerTests.HandlerWithTwoHandlersMethodShouldProduceNothing#IH.ServiceCollectionExtensions.g.verified.cs
- tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/InvalidHandlerTests.HandlerWithNoParametersShouldProduceNothing#IH.ServiceCollectionExtensions.g.verified.cs
- tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/InvalidHandlerTests.HandlerWithoutHandlerMethodShouldProduceNothing#IH.ServiceCollectionExtensions.g.verified.cs
- tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/InvalidBehaviorsTests.NonBehaviorShouldProduceNothing#IH.ServiceCollectionExtensions.g.verified.cs
- tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/InvalidHandlerTests.InstanceHandlerMethodWithTooManyParametersShouldProduceNothing#IH.ServiceCollectionExtensions.g.verified.cs
- tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/BehaviorTests.MultipleBehaviors#IH.ServiceCollectionExtensions.g.verified.cs
- tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/BehaviorTests.NullableBehavior_behaviorNullable=False_returnNullable=False#IH.ServiceCollectionExtensions.g.verified.cs
- tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/BehaviorTests.BehaviorHasMultipleTResponseConstraints#IH.ServiceCollectionExtensions.g.verified.cs
- tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/InvalidHandlerTests.HandlerWithTaskResponseShouldProduceNothing#IH.ServiceCollectionExtensions.g.verified.cs
- tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/InvalidHandlerTests.NestedHandlerShouldProduceNothing#IH.ServiceCollectionExtensions.g.verified.cs
- tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/HandlerTests.MissingCancellationToken_modifier=static#IH.ServiceCollectionExtensions.g.verified.cs
- tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/InvalidHandlerTests.HandlerWithVoidResponseShouldProduceNothing#IH.ServiceCollectionExtensions.g.verified.cs
- tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/InvalidBehaviorsTests.BoundGenericShouldProduceNothing#IH.ServiceCollectionExtensions.g.verified.cs
- tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/InvalidBehaviorsTests.AbstractBehaviorShouldProduceNothing#IH.ServiceCollectionExtensions.g.verified.cs
- tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/HandlerTests.ServiceLifetime_lifetime=Singleton#IH.ServiceCollectionExtensions.g.verified.cs
- tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/BehaviorTests.NullableBehavior_behaviorNullable=True_returnNullable=False#IH.ServiceCollectionExtensions.g.verified.cs
- tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/StreamingHandlerTests.StreamingIntReturnType_modifier=static#IH.ServiceCollectionExtensions.g.verified.cs
- tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/HandlerTests.VoidReturnType_modifier=static#IH.ServiceCollectionExtensions.g.verified.cs
- tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/BehaviorTests.ZeroTypeParameterBehavior#IH.ServiceCollectionExtensions.g.verified.cs
- tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/BehaviorTests.RequestTypeParameterBehavior#IH.ServiceCollectionExtensions.g.verified.cs
- tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/InvalidBehaviorsTests.BehaviorHasTooManyTypeParametersShouldProduceNothing#IH.ServiceCollectionExtensions.g.verified.cs
- tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/HandlerTests.SimpleParameterAttribute#IH.ServiceCollectionExtensions.g.verified.cs
- tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/HandlerTests.IntReturnType_modifier=static#IH.ServiceCollectionExtensions.g.verified.cs
- tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/HandlerTests.VoidReturnType_modifier=
#IH.ServiceCollectionExtensions.g.verified.cs - tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/BehaviorTests.NestedBehavior#IH.ServiceCollectionExtensions.g.verified.cs
- tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/ImmediateAssemblyIdentifierTests.ImmediateAssemblyIdentifierOverridesAssemblyName#IH.ServiceCollectionExtensions.g.verified.cs
- tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/HandlerTests.ServiceLifetime_lifetime=Transient#IH.ServiceCollectionExtensions.g.verified.cs
- tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/HandlerTests.ServiceLifetime_lifetime=Scoped#IH.ServiceCollectionExtensions.g.verified.cs
- tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/BehaviorTests.CrtpBehavior#IH.ServiceCollectionExtensions.g.verified.cs
- tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/BehaviorTests.BehaviorHasMultipleTRequestConstraints#IH.ServiceCollectionExtensions.g.verified.cs
- tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/BehaviorTests.ResponseTypeParameterBehavior#IH.ServiceCollectionExtensions.g.verified.cs
- tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/HandlerTests.MultipleParameterAttributes#IH.ServiceCollectionExtensions.g.verified.cs
- tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/StreamingHandlerTests.StreamingIntReturnType_modifier=
#IH.ServiceCollectionExtensions.g.verified.cs - tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/StreamingHandlerTests.StreamingBehavior#IH.ServiceCollectionExtensions.g.verified.cs
- tests/Immediate.Handlers.Tests/GeneratorTests/Snapshots/BehaviorTests.NullableBehavior_behaviorNullable=True_returnNullable=True#IH.ServiceCollectionExtensions.g.verified.cs
Summary by CodeRabbit
New Features
ReadOnlySpan<string>for more flexible registration scenarios.Bug Fixes
Tests