Path: redb-route/tests/redb.Route.Tests.Firebase/ServiceCollectionExtensionsTests.cs Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route Page: https://redbase.app/src/dev-2026-12-06/redb-route/tests/redb.Route.Tests.Firebase/ServiceCollectionExtensionsTests.cs ---- using Microsoft.Extensions.DependencyInjection; using redb.Route.Core; using redb.Route.Extensions; using redb.Route.Firebase; namespace redb.Route.Tests.Firebase; /// /// Acceptance test for the documented registration path: /// AddRedbRoute() + AddRedbRouteFirebase() must register the components in the /// route context through — the hook /// actually applies at startup. A lazy marker singleton /// nobody resolves does NOT count. /// public sealed class ServiceCollectionExtensionsTests { [Fact] public async Task AddRedbRouteFirebase_HostedStartupPath_RegistersAllSchemes() { var services = new ServiceCollection(); services.AddLogging(); services.AddRedbRoute(); services.AddRedbRouteFirebase(); await using var sp = services.BuildServiceProvider(); var context = sp.GetRequiredService(); // Exactly what RouteHostedService.StartAsync does before Start(): foreach (var configurator in sp.GetServices()) configurator.Configure(context); context.HasComponent("fcm").Should().BeTrue( "AddRedbRouteFirebase must register the components through IRouteContextConfigurator"); context.HasComponent("fstore").Should().BeTrue(); context.HasComponent("fbstorage").Should().BeTrue(); } [Fact] public async Task AddRedbRouteFirebase_ComponentsShareCredentialProvider() { var services = new ServiceCollection(); services.AddLogging(); services.AddRedbRoute(); services.AddRedbRouteFirebase(); await using var sp = services.BuildServiceProvider(); var context = sp.GetRequiredService(); foreach (var configurator in sp.GetServices()) configurator.Configure(context); var provider = sp.GetRequiredService(); sp.GetRequiredService().CredentialProvider.Should().BeSameAs(provider); sp.GetRequiredService().CredentialProvider.Should().BeSameAs(provider); sp.GetRequiredService().CredentialProvider.Should().BeSameAs(provider); } }