< Summary

Information
Class: IceRpc.LocatorPipelineExtensions
Assembly: IceRpc.Locator
File(s): /home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc.Locator/LocatorPipelineExtensions.cs
Tag: 275_13775359185
Line coverage
0%
Covered lines: 0
Uncovered lines: 8
Coverable lines: 8
Total lines: 41
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: 3
Method coverage: 0%

Metrics

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

File(s)

/home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc.Locator/LocatorPipelineExtensions.cs

#LineLine coverage
 1// Copyright (c) ZeroC, Inc.
 2
 3using IceRpc.Locator;
 4using IceRpc.Slice.Ice;
 5using Microsoft.Extensions.Logging;
 6using Microsoft.Extensions.Logging.Abstractions;
 7
 8namespace IceRpc;
 9
 10/// <summary>Provides extension methods for <see cref="Pipeline" /> to add the locator interceptor.</summary>
 11public static class LocatorPipelineExtensions
 12{
 13    /// <summary>Adds a <see cref="LocatorInterceptor" /> to the pipeline, using the specified locator.</summary>
 14    /// <param name="pipeline">The pipeline being configured.</param>
 15    /// <param name="locator">The locator used for the resolutions.</param>
 16    /// <returns>The pipeline being configured.</returns>
 17    public static Pipeline UseLocator(this Pipeline pipeline, ILocator locator) =>
 018        UseLocator(pipeline, locator, NullLoggerFactory.Instance);
 19
 20    /// <summary>Adds a <see cref="LocatorInterceptor" /> to the pipeline, using the specified locator.</summary>
 21    /// <param name="pipeline">The pipeline being configured.</param>
 22    /// <param name="locator">The locator used for the resolutions.</param>
 23    /// <param name="loggerFactory">The logger factory used to create a <see cref="ILogger{TCategoryName}" /> for
 24    /// <see cref="LocatorInterceptor" />.</param>
 25    /// <returns>The pipeline being configured.</returns>
 26    public static Pipeline UseLocator(this Pipeline pipeline, ILocator locator, ILoggerFactory loggerFactory) =>
 027        UseLocator(
 028            pipeline,
 029            new LocatorLocationResolver(
 030                locator,
 031                new LocatorOptions(),
 032                loggerFactory.CreateLogger<LocatorInterceptor>()));
 33
 34    /// <summary>Adds a <see cref="LocatorInterceptor" /> to the pipeline, using the specified location resolver.
 35    /// </summary>
 36    /// <param name="pipeline">The pipeline being configured.</param>
 37    /// <param name="locationResolver">The location resolver instance.</param>
 38    /// <returns>The pipeline being configured.</returns>
 39    public static Pipeline UseLocator(this Pipeline pipeline, ILocationResolver locationResolver) =>
 040        pipeline.Use(next => new LocatorInterceptor(next, locationResolver));
 41}