< Summary

Information
Class: IceRpc.Retry.RetryOptions
Assembly: IceRpc.Retry
File(s): /home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc.Retry/RetryOptions.cs
Tag: 275_13775359185
Line coverage
40%
Covered lines: 8
Uncovered lines: 12
Coverable lines: 20
Total lines: 49
Line coverage: 40%
Branch coverage
25%
Covered branches: 1
Total branches: 4
Branch coverage: 25%
Method coverage
80%
Covered methods: 4
Total methods: 5
Method coverage: 80%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_MaxAttempts()100%11100%
set_MaxAttempts(...)50%2.5250%
get_MaxPayloadSize()100%11100%
set_MaxPayloadSize(...)0%620%
.ctor()100%11100%

File(s)

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

#LineLine coverage
 1// Copyright (c) ZeroC, Inc.
 2
 3namespace IceRpc.Retry;
 4
 5/// <summary>A property bag used to configure a <see cref="RetryInterceptor" />.</summary>
 6public sealed record class RetryOptions
 7{
 8    /// <summary>Gets or sets the maximum number of attempts for retrying a request.</summary>
 9    /// <value>The maximum number of attempts for retrying a request. Defaults to <c>2</c> attempts.</value>
 10    public int MaxAttempts
 11    {
 1612        get => _maxAttempts;
 13        set
 314        {
 315            if (value < 1)
 016            {
 017                throw new ArgumentOutOfRangeException(
 018                    nameof(value),
 019                    $"Invalid value '{value}' for '{nameof(MaxAttempts)}', it must be greater than 0.");
 20            }
 321            _maxAttempts = value;
 322        }
 23    }
 24
 25    /// <summary>Gets or sets the maximum size of the request payload in bytes for which retries would be considered.
 26    /// Requests with a larger payload or a payload continuation are never retried.</summary>
 27    /// <value>The maximum request payload size in bytes for which retries will be attempted. Defaults to <c>1</c> MB.
 28    /// </value>
 29    /// <remarks>The ability to retry depends on keeping the request payload around until a successful response has been
 30    /// received or retries are no longer possible, this setting affects the working memory that the application will
 31    /// consume.</remarks>
 32    public int MaxPayloadSize
 33    {
 1634        get => _maxPayloadSize;
 35        set
 036        {
 037            if (value < 1)
 038            {
 039                throw new ArgumentOutOfRangeException(
 040                    nameof(value),
 041                    $"Invalid value '{value}' for '{nameof(MaxPayloadSize)}' it must be greater than 0.");
 42            }
 043            _maxPayloadSize = value;
 044        }
 45    }
 46
 1647    private int _maxAttempts = 2;
 1648    private int _maxPayloadSize = 1024 * 1024;
 49}