< Summary

Information
Class: IceRpc.ConnectionCacheOptions
Assembly: IceRpc
File(s): /home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc/ConnectionCacheOptions.cs
Tag: 275_13775359185
Line coverage
63%
Covered lines: 7
Uncovered lines: 4
Coverable lines: 11
Total lines: 50
Line coverage: 63.6%
Branch coverage
0%
Covered branches: 0
Total branches: 4
Branch coverage: 0%
Method coverage
75%
Covered methods: 6
Total methods: 8
Method coverage: 75%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_ClientAuthenticationOptions()100%11100%
get_ConnectionOptions()100%11100%
get_ConnectTimeout()100%11100%
set_ConnectTimeout(...)0%620%
get_PreferExistingConnection()100%11100%
get_ShutdownTimeout()100%11100%
set_ShutdownTimeout(...)0%620%
.ctor()100%11100%

File(s)

/home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc/ConnectionCacheOptions.cs

#LineLine coverage
 1// Copyright (c) ZeroC, Inc.
 2
 3using System.Net.Security;
 4
 5namespace IceRpc;
 6
 7/// <summary>Represents a property bag used to configure a <see cref="ConnectionCache" />.</summary>
 8public record class ConnectionCacheOptions
 9{
 10    /// <summary>Gets or sets the SSL client authentication options.</summary>
 11    /// <value>The SSL client authentication options. When not <see langword="null" />,
 12    /// <see cref="ClientConnection.ConnectAsync(CancellationToken)" /> will either establish a secure connection or
 13    /// fail.</value>
 1814    public SslClientAuthenticationOptions? ClientAuthenticationOptions { get; set; }
 15
 16    /// <summary>Gets or sets the connection options used for connections created by the connection cache.</summary>
 17    /// <value>The connection options. Defaults to a default constructed <see cref="ConnectionOptions" />.</value>
 3618    public ConnectionOptions ConnectionOptions { get; set; } = new();
 19
 20    /// <summary>Gets or sets the connection establishment timeout for connections created by the connection cache.
 21    /// </summary>
 22    /// <value>The connection establishment timeout. Defaults to <c>10</c> seconds.</value>
 23    public TimeSpan ConnectTimeout
 24    {
 1825        get => _connectTimeout;
 026        set => _connectTimeout = value != TimeSpan.Zero ? value :
 027            throw new ArgumentException($"0 is not a valid value for {nameof(ConnectTimeout)}", nameof(value));
 28    }
 29
 30    /// <summary>Gets or sets a value indicating whether or not the connection cache prefers an active connection over
 31    /// creating a new one.</summary>
 32    /// <value>When <see langword="true" />, the connection cache first checks the server addresses of the target
 33    /// service address: if any matches an active connection it manages, it sends the request over this connection. It
 34    /// does not check connections being connected. When <see langword="false" />, the connection cache does not prefer
 35    /// existing connections.</value>
 3836    public bool PreferExistingConnection { get; set; } = true;
 37
 38    /// <summary>Gets or sets the shutdown timeout. This timeout is used when gracefully shutting down a connection
 39    /// managed by the connection cache.</summary>
 40    /// <value>This shutdown timeout. Defaults to <c>10</c> seconds.</value>
 41    public TimeSpan ShutdownTimeout
 42    {
 1843        get => _shutdownTimeout;
 044        set => _shutdownTimeout = value != TimeSpan.Zero ? value :
 045            throw new ArgumentException($"0 is not a valid value for {nameof(ShutdownTimeout)}", nameof(value));
 46    }
 47
 1848    private TimeSpan _connectTimeout = TimeSpan.FromSeconds(10);
 1849    private TimeSpan _shutdownTimeout = TimeSpan.FromSeconds(10);
 50}