< Summary

Information
Class: IceRpc.Extensions.DependencyInjection.Internal.InvokerBuilder
Assembly: IceRpc.Extensions.DependencyInjection
File(s): /home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc.Extensions.DependencyInjection/Internal/InvokerBuilder.cs
Tag: 275_13775359185
Line coverage
100%
Covered lines: 15
Uncovered lines: 0
Coverable lines: 15
Total lines: 33
Line coverage: 100%
Branch coverage
50%
Covered branches: 1
Total branches: 2
Branch coverage: 50%
Method coverage
100%
Covered methods: 5
Total methods: 5
Method coverage: 100%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_ServiceProvider()100%11100%
.ctor(...)100%11100%
Into(...)100%11100%
Use(...)100%11100%
Build()50%22100%

File(s)

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

#LineLine coverage
 1// Copyright (c) ZeroC, Inc.
 2
 3namespace IceRpc.Extensions.DependencyInjection.Internal;
 4
 5/// <summary>Implements <see cref="IInvokerBuilder" /> for Microsoft's DI container.</summary>
 6internal sealed class InvokerBuilder : IInvokerBuilder
 7{
 68    public IServiceProvider ServiceProvider { get; }
 9
 10    private bool _isIntoCalled;
 11
 612    private readonly Pipeline _pipeline = new();
 13
 14    public IInvokerBuilder Into(IInvoker invoker)
 615    {
 616        _ = _pipeline.Into(invoker);
 617        _isIntoCalled = true;
 618        return this;
 619    }
 20
 21    public IInvokerBuilder Use(Func<IInvoker, IInvoker> interceptor)
 822    {
 823        _ = _pipeline.Use(interceptor);
 824        return this;
 825    }
 26
 1227    internal InvokerBuilder(IServiceProvider provider) => ServiceProvider = provider;
 28
 29    internal IInvoker Build() =>
 630        _isIntoCalled ? _pipeline :
 631            throw new InvalidOperationException(
 632                $"The configure action on the {nameof(IInvokerBuilder)} must include a call to {nameof(Into)}.");
 33}