-
Notifications
You must be signed in to change notification settings - Fork 5
Add Queue Storage DI tests #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughAdds a new test project with DI integration tests for Azure Queue Storage components. Introduces two empty marker structs for generic registrations. Tests verify service registrations, generic marker variants, and options delegates for AzureCommandQueue and AzureEventBus using both Newtonsoft.Json and System.Text.Json marshallers. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Dev as Test
participant DI as ServiceCollection
participant Prov as ServiceProvider
participant CQ as AzureCommandQueue / AzureCommandQueue<TMarker>
participant EB as AzureEventBus / AzureEventBus<TMarker>
Note over Dev,DI: Register command queue
Dev->>DI: AddAzureCommandQueue(azureSetup)
DI-->>DI: Register IPointToPointChannel/I(S/R) for ICommand -> CQ
DI-->>DI: Store AzureQueueOptions delegate
Note over Dev,DI: Register event bus
Dev->>DI: AddAzureEventBus(eventBusSetup)
DI-->>DI: Register IPubSub/I(Pub/Sub) for IIntegrationEvent -> EB
DI-->>DI: Store EventBusOptions delegate
Dev->>DI: BuildServiceProvider()
DI-->>Dev: Prov
Dev->>Prov: GetService(IPointToPointChannel<ICommand>[, TMarker])
Prov-->>Dev: CQ instance
Dev->>Prov: GetService(IPublishSubscribeChannel<IIntegrationEvent>[, TMarker])
Prov-->>Dev: EB instance
Note over Dev: Assert types and option delegate equivalence
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Pre-merge checks (2 passed, 1 warning)❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
Poem
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #40 +/- ##
==========================================
+ Coverage 77.82% 78.92% +1.10%
==========================================
Files 177 177
Lines 3711 3711
Branches 365 365
==========================================
+ Hits 2888 2929 +41
+ Misses 821 780 -41
Partials 2 2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (4)
test/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests/Assets/QueueMarker.cs (1)
3-5: Make the marker immutable and add XML docs.Prevents accidental mutation and aligns with repo doc-comment guidelines.
namespace Savvyio.Extensions.DependencyInjection.QueueStorage.Assets { - public struct QueueMarker - { - } + /// <summary> + /// Marker type used to differentiate generic DI registrations in tests. + /// </summary> + public readonly struct QueueMarker + { + } }test/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests.csproj (1)
11-12: Remove redundant folder include.MSBuild includes folders implicitly; this entry is unnecessary noise.
- <ItemGroup> - <Folder Include="Assets\" /> - </ItemGroup>test/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests/Assets/BusMarker.cs (1)
3-5: Mirror QueueMarker: make readonly and document.Consistent, immutable marker with XML docs.
namespace Savvyio.Extensions.DependencyInjection.QueueStorage.Assets { - public struct BusMarker - { - } + /// <summary> + /// Marker type used to differentiate generic DI registrations for event bus in tests. + /// </summary> + public readonly struct BusMarker + { + } }test/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests/ServiceCollectionExtensionsTest.cs (1)
43-43: Enable DI validation and assert marshaller type.Catches misconfigured registrations early and verifies the intended marshaller is wired.
- var provider = services.BuildServiceProvider(); + using var provider = services.BuildServiceProvider(new ServiceProviderOptions + { + ValidateOnBuild = true, + ValidateScopes = true + }); + Assert.IsType<NewtonsoftJsonMarshaller>(provider.GetRequiredService<IMarshaller>()); - var provider = services.BuildServiceProvider(); + using var provider = services.BuildServiceProvider(new ServiceProviderOptions + { + ValidateOnBuild = true, + ValidateScopes = true + }); + Assert.IsType<JsonMarshaller>(provider.GetRequiredService<IMarshaller>()); - var provider = services.BuildServiceProvider(); + using var provider = services.BuildServiceProvider(new ServiceProviderOptions + { + ValidateOnBuild = true, + ValidateScopes = true + }); + Assert.IsType<NewtonsoftJsonMarshaller>(provider.GetRequiredService<IMarshaller>()); - var provider = services.BuildServiceProvider(); + using var provider = services.BuildServiceProvider(new ServiceProviderOptions + { + ValidateOnBuild = true, + ValidateScopes = true + }); + Assert.IsType<JsonMarshaller>(provider.GetRequiredService<IMarshaller>());Also applies to: 76-76, 114-114, 161-161
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
test/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests/Assets/BusMarker.cs(1 hunks)test/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests/Assets/QueueMarker.cs(1 hunks)test/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests.csproj(1 hunks)test/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests/ServiceCollectionExtensionsTest.cs(1 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
test/**
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Place tests in dedicated test projects/folders (under the test directory)
Files:
test/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests.csprojtest/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests/Assets/BusMarker.cstest/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests/Assets/QueueMarker.cstest/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests/ServiceCollectionExtensionsTest.cs
test/**/*.Tests/**
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Unit tests for an assembly should reside in a corresponding .Tests assembly (e.g., Savvyio.Foo.Tests)
Files:
test/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests.csprojtest/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests/Assets/BusMarker.cstest/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests/Assets/QueueMarker.cstest/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests/ServiceCollectionExtensionsTest.cs
test/**/*.csproj
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Override RootNamespace in test project .csproj to match the product assembly namespace (e.g., Savvyio.Foo)
Files:
test/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests.csproj
test/**/*.cs
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use namespaces in tests that mirror the source code structure
Files:
test/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests/Assets/BusMarker.cstest/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests/Assets/QueueMarker.cstest/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests/ServiceCollectionExtensionsTest.cs
**/*.cs
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.cs: Follow the repository’s established XML documentation style
Add XML documentation comments to public and protected classes and methods where appropriate
Files:
test/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests/Assets/BusMarker.cstest/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests/Assets/QueueMarker.cstest/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests/ServiceCollectionExtensionsTest.cs
**/*Test.cs
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*Test.cs: All unit test classes must inherit from Codebelt.Extensions.Xunit.Test
Use [Fact] for standard unit tests
Use [Theory] with [InlineData] or other data sources for parameterized tests
Test method names should be descriptive and express expected behavior (e.g., ShouldReturnTrue_WhenConditionIsMet)
Use xUnit Assert methods for all assertions (e.g., Assert.Equal, Assert.NotNull, Assert.Contains)
Keep tests focused, isolated, deterministic, and repeatable; avoid external systems except xUnit and Codebelt.Extensions.Xunit
Prefer dummies, fakes, stubs, and spies; use Moq-based mocks only when necessary
Before overriding or mocking, ensure targeted methods are virtual or abstract
Never mock IMarshaller; use a new JsonMarshaller instance instead
Files:
test/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests/ServiceCollectionExtensionsTest.cs
test/**/*Test.cs
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Test class files must be named with a Test suffix (e.g., CommandDispatcherTest)
Files:
test/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests/ServiceCollectionExtensionsTest.cs
🧠 Learnings (4)
📚 Learning: 2025-08-31T21:08:55.124Z
Learnt from: gimlichael
PR: codebeltnet/savvyio#39
File: test/Savvyio.Extensions.QueueStorage.Tests/Savvyio.Extensions.QueueStorage.Tests.csproj:7-9
Timestamp: 2025-08-31T21:08:55.124Z
Learning: In the Savvyio codebase, Directory.Build.props automatically configures test projects (identified by path patterns containing "test/" or ".Tests") with IsPackable=false and PrivateAssets=all for PackageReferences, eliminating the need to manually add these settings to individual test project files.
Applied to files:
test/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests.csproj
📚 Learning: 2025-08-31T21:29:11.431Z
Learnt from: CR
PR: codebeltnet/savvyio#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-31T21:29:11.431Z
Learning: Applies to test/**/*.csproj : Override RootNamespace in test project .csproj to match the product assembly namespace (e.g., <RootNamespace>Savvyio.Foo</RootNamespace>)
Applied to files:
test/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests.csproj
📚 Learning: 2025-08-31T21:08:55.124Z
Learnt from: gimlichael
PR: codebeltnet/savvyio#39
File: test/Savvyio.Extensions.QueueStorage.Tests/Savvyio.Extensions.QueueStorage.Tests.csproj:7-9
Timestamp: 2025-08-31T21:08:55.124Z
Learning: In the Savvyio codebase, Directory.Build.props automatically handles test project configuration through the IsTestProject property (determined by project names ending with 'Tests'). For test projects, it automatically sets IsPackable=false and includes common test packages with PrivateAssets=all, making manual configuration in individual test project files unnecessary.
Applied to files:
test/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests.csproj
📚 Learning: 2025-08-31T21:29:11.431Z
Learnt from: CR
PR: codebeltnet/savvyio#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-08-31T21:29:11.431Z
Learning: Applies to test/**/*.Tests/** : Unit tests for an assembly should reside in a corresponding .Tests assembly (e.g., Savvyio.Foo.Tests)
Applied to files:
test/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests.csproj
🧬 Code graph analysis (2)
test/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests/Assets/BusMarker.cs (3)
test/Savvyio.Extensions.DependencyInjection.SimpleQueueService.Tests/Assets/BusMarker.cs (1)
Savvyio(1-7)test/Savvyio.Extensions.DependencyInjection.RabbitMQ.Tests/Assets/BusMarker.cs (2)
Savvyio(1-7)BusMarker(3-6)test/Savvyio.Extensions.DependencyInjection.NATS.Tests/Assets/BusMarker.cs (2)
Savvyio(1-7)BusMarker(3-6)
test/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests/ServiceCollectionExtensionsTest.cs (1)
test/Savvyio.Extensions.DependencyInjection.SimpleQueueService.Tests/ServiceCollectionExtensionsTest.cs (2)
ServiceCollectionExtensionsTest(23-160)Savvyio(21-161)
|
Remember to update solution. |



Summary
Testing
dotnet test test/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests/Savvyio.Extensions.DependencyInjection.QueueStorage.Tests.csproj --collect:"XPlat Code Coverage" --results-directory coverage --no-build --verbosity minimalhttps://chatgpt.com/codex/tasks/task_e_68c1c7ccf40c8330a1d8efbfe141bce2
Summary by CodeRabbit
Tests
Chores