< Summary

Information
Class: IceRpc.RetryPipelineExtensions
Assembly: IceRpc.Retry
File(s): /home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc.Retry/RetryPipelineExtensions.cs
Tag: 275_13775359185
Line coverage
0%
Covered lines: 0
Uncovered lines: 3
Coverable lines: 3
Total lines: 52
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
UseRetry(...)100%210%
UseRetry(...)100%210%
UseRetry(...)100%210%

File(s)

/home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc.Retry/RetryPipelineExtensions.cs

#LineLine coverage
 1// Copyright (c) ZeroC, Inc.
 2
 3using IceRpc.Retry;
 4using Microsoft.Extensions.Logging;
 5using Microsoft.Extensions.Logging.Abstractions;
 6
 7namespace IceRpc;
 8
 9/// <summary>Provides extension methods for <see cref="Pipeline" /> to add the retry interceptor.</summary>
 10public static class RetryPipelineExtensions
 11{
 12    /// <summary>Adds a <see cref="RetryInterceptor" /> that uses the default <see cref="RetryOptions" /> to the
 13    /// pipeline.</summary>
 14    /// <param name="pipeline">The pipeline being configured.</param>
 15    /// <returns>The pipeline being configured.</returns>
 16    /// <example>
 17    /// The following code adds the retry interceptor using the default <see cref="RetryOptions"/> to the invocation
 18    /// pipeline.
 19    /// <code source="../../docfx/examples/IceRpc.Retry.Examples/RetryInterceptorExamples.cs" region="UseRetry" lang="cs
 20    /// </example>
 21    /// <seealso href="https://github.com/icerpc/icerpc-csharp/tree/main/examples/Retry"/>
 22    public static Pipeline UseRetry(this Pipeline pipeline) =>
 023        pipeline.UseRetry(new RetryOptions());
 24
 25    /// <summary>Adds a <see cref="RetryInterceptor" /> to the pipeline.</summary>
 26    /// <param name="pipeline">The pipeline being configured.</param>
 27    /// <param name="options">The options to configure the <see cref="RetryInterceptor" />.</param>
 28    /// <returns>The pipeline being configured.</returns>
 29    /// <example>
 30    /// The following code adds the retry interceptor using the provided <see cref="RetryOptions"/> to the invocation
 31    /// pipeline.
 32    /// <code source="../../docfx/examples/IceRpc.Retry.Examples/RetryInterceptorExamples.cs" region="UseRetryWithOption
 33    /// </example>
 34    /// <seealso href="https://github.com/icerpc/icerpc-csharp/tree/main/examples/Retry"/>
 35    public static Pipeline UseRetry(this Pipeline pipeline, RetryOptions options) =>
 036        pipeline.UseRetry(options, NullLoggerFactory.Instance);
 37
 38    /// <summary>Adds a <see cref="RetryInterceptor" /> to the pipeline.</summary>
 39    /// <param name="pipeline">The pipeline being configured.</param>
 40    /// <param name="options">The options to configure the <see cref="RetryInterceptor" />.</param>
 41    /// <param name="loggerFactory">The logger factory used to create a <see cref="ILogger{TCategoryName}" /> for
 42    /// <see cref="RetryInterceptor" />.</param>
 43    /// <returns>The pipeline being configured.</returns>
 44    /// <example>
 45    /// The following code adds the retry interceptor using the provided <see cref="ILoggerFactory"/> and
 46    /// <see cref="RetryOptions"/> to the invocation pipeline.
 47    /// <code source="../../docfx/examples/IceRpc.Retry.Examples/RetryInterceptorExamples.cs" region="UseRetryWithLogger
 48    /// </example>
 49    /// <seealso href="https://github.com/icerpc/icerpc-csharp/tree/main/examples/Retry"/>
 50    public static Pipeline UseRetry(this Pipeline pipeline, RetryOptions options, ILoggerFactory loggerFactory) =>
 051        pipeline.Use(next => new RetryInterceptor(next, options, loggerFactory.CreateLogger<RetryInterceptor>()));
 52}