< Summary

Information
Class: IceRpc.Extensions.DependencyInjection.DispatcherServiceCollectionExtensions
Assembly: IceRpc.Extensions.DependencyInjection
File(s): /home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc.Extensions.DependencyInjection/DispatcherServiceCollectionExtensions.cs
Tag: 275_13775359185
Line coverage
0%
Covered lines: 0
Uncovered lines: 6
Coverable lines: 6
Total lines: 24
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage
0%
Covered methods: 0
Total methods: 1
Method coverage: 0%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
AddIceRpcDispatcher(...)100%210%

File(s)

/home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc.Extensions.DependencyInjection/DispatcherServiceCollectionExtensions.cs

#LineLine coverage
 1// Copyright (c) ZeroC, Inc.
 2
 3using IceRpc.Extensions.DependencyInjection.Internal;
 4using Microsoft.Extensions.DependencyInjection;
 5
 6namespace IceRpc.Extensions.DependencyInjection;
 7
 8/// <summary>Provides an extension method for <see cref="IServiceCollection" /> to add a dispatcher.</summary>
 9public static class DispatcherServiceCollectionExtensions
 10{
 11    /// <summary>Adds an <see cref="IDispatcher" /> to this service collection.</summary>
 12    /// <param name="services">The service collection to add services to.</param>
 13    /// <param name="configure">The action to configure the new dispatcher.</param>
 14    /// <returns>The service collection.</returns>
 15    public static IServiceCollection AddIceRpcDispatcher(
 16        this IServiceCollection services,
 17        Action<IDispatcherBuilder> configure) =>
 018        services.AddSingleton(provider =>
 019        {
 020            var builder = new DispatcherBuilder(provider);
 021            configure(builder);
 022            return builder.Build();
 023        });
 24}