-
Notifications
You must be signed in to change notification settings - Fork 0
Support configuring SignalR and use CQRS JSON serialization options by default #83
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
Merged
Dragemil
merged 6 commits into
main
from
feature/serialization-configuration-extensibility
Jan 12, 2026
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
990a887
Configure CQRS JSON serialization by default in SignalR
Dragemil dffdca1
Add extensibility for LeanPipeHub configuration in SignalR setup
Dragemil d699bbc
Test SignalR configurations extensions
Dragemil bab0d16
Configure CQRS JSON serialization by default in topic extractor
Dragemil 9b2857f
Test LeanPipe services builder
Dragemil 7887980
Bump CoreLib version and use exposed CQRS Serialization options
Dragemil File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
...test/Funnel.Tests/LeanCode.Pipe.Funnel.Tests/Instance/ServiceCollectionExtensionsTests.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| using System.Text.Json; | ||
| using LeanCode.Pipe.Funnel.Instance; | ||
| using Microsoft.AspNetCore.SignalR; | ||
| using Microsoft.Extensions.Caching.Memory; | ||
| using Microsoft.Extensions.DependencyInjection; | ||
| using Microsoft.Extensions.Options; | ||
|
|
||
| namespace LeanCode.Pipe.Funnel.Tests.Instance; | ||
|
|
||
| public class ServiceCollectionExtensionsTests | ||
| { | ||
| [Fact] | ||
| public void Registers_required_basic_types_when_service_is_funnel() | ||
| { | ||
| var collection = new ServiceCollection(); | ||
| collection.AddLeanPipeFunnel(); | ||
| collection | ||
| .Should() | ||
| .ContainSingle(d => | ||
| d.ServiceType == typeof(HubLifetimeManager<>) | ||
| && d.Lifetime == ServiceLifetime.Singleton | ||
| ) | ||
| .And.ContainSingle(d => | ||
| d.ServiceType == typeof(IMemoryCache) && d.Lifetime == ServiceLifetime.Singleton | ||
| ) | ||
| .And.ContainSingle(d => | ||
| d.ServiceType == typeof(FunnelConfiguration) | ||
| && d.Lifetime == ServiceLifetime.Singleton | ||
| ) | ||
| .And.ContainSingle(d => | ||
| d.ServiceType == typeof(ISubscriptionExecutor) | ||
| && d.Lifetime == ServiceLifetime.Transient | ||
| ); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void Default_serializer_configuration_is_applied_to_funnel_when_no_override_is_provided() | ||
| { | ||
| var collection = new ServiceCollection(); | ||
| collection.AddLeanPipeFunnel(); | ||
|
|
||
| var provider = collection.BuildServiceProvider(); | ||
| var hubProtocolOptions = provider | ||
| .GetRequiredService<IOptions<JsonHubProtocolOptions>>() | ||
| .Value; | ||
|
|
||
| hubProtocolOptions.PayloadSerializerOptions.PropertyNamingPolicy.Should().BeNull(); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void Override_replaces_default_serializer_configuration_in_funnel() | ||
| { | ||
| var collection = new ServiceCollection(); | ||
| collection.AddLeanPipeFunnel(overrideJsonHubProtocolOptions: options => | ||
| options.PayloadSerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase | ||
| ); | ||
|
|
||
| var provider = collection.BuildServiceProvider(); | ||
| var hubProtocolOptions = provider | ||
| .GetRequiredService<IOptions<JsonHubProtocolOptions>>() | ||
| .Value; | ||
|
|
||
| hubProtocolOptions | ||
| .PayloadSerializerOptions.PropertyNamingPolicy.Should() | ||
| .Be(JsonNamingPolicy.CamelCase); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void Hub_options_delegate_is_invoked_when_provided_to_funnel() | ||
| { | ||
| var collection = new ServiceCollection(); | ||
| collection.AddLeanPipeFunnel(configureLeanPipeHub: options => | ||
| options.MaximumReceiveMessageSize = 12345 | ||
| ); | ||
|
|
||
| var provider = collection.BuildServiceProvider(); | ||
| var hubOptions = provider | ||
| .GetRequiredService<IOptions<HubOptions<LeanPipeSubscriber>>>() | ||
| .Value; | ||
|
|
||
| hubOptions.MaximumReceiveMessageSize.Should().Be(12345); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.