< Summary

Information
Class: IceRpc.Transports.Quic.QuicServerTransport
Assembly: IceRpc
File(s): /home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc/Transports/Quic/QuicServerTransport.cs
Tag: 592_20856082467
Line coverage
73%
Covered lines: 19
Uncovered lines: 7
Coverable lines: 26
Total lines: 64
Line coverage: 73%
Branch coverage
75%
Covered branches: 9
Total branches: 12
Branch coverage: 75%
Method coverage
100%
Covered methods: 4
Total methods: 4
Method coverage: 100%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Name()100%11100%
.ctor(...)100%11100%
.ctor()100%11100%
Listen(...)75%17.341266.66%

File(s)

/home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc/Transports/Quic/QuicServerTransport.cs

#LineLine coverage
 1// Copyright (c) ZeroC, Inc.
 2
 3using IceRpc.Transports.Quic.Internal;
 4using System.Net.Quic;
 5using System.Net.Security;
 6using System.Runtime.Versioning;
 7
 8namespace IceRpc.Transports.Quic;
 9
 10/// <summary>Implements <see cref="IMultiplexedServerTransport"/> using QUIC.</summary>
 11[SupportedOSPlatform("linux")]
 12[SupportedOSPlatform("macos")]
 13[SupportedOSPlatform("windows")]
 14public class QuicServerTransport : IMultiplexedServerTransport
 15{
 16    /// <inheritdoc/>
 12417    public string Name => "quic";
 18
 19    private readonly QuicServerTransportOptions _quicOptions;
 20
 21    /// <summary>Constructs a QUIC server transport.</summary>
 22    /// <param name="options">The options to configure the transport.</param>
 24823    public QuicServerTransport(QuicServerTransportOptions options) => _quicOptions = options;
 24
 25    /// <summary>Constructs a QUIC server transport.</summary>
 26    public QuicServerTransport()
 127        : this(new QuicServerTransportOptions())
 128    {
 129    }
 30
 31    /// <inheritdoc/>
 32    public IListener<IMultiplexedConnection> Listen(
 33        ServerAddress serverAddress,
 34        MultiplexedConnectionOptions options,
 35        SslServerAuthenticationOptions? serverAuthenticationOptions)
 12436    {
 12437        if (!QuicListener.IsSupported)
 038        {
 039            throw new NotSupportedException(
 040                "The QUIC server transport is not available on this system. Please review the Platform Dependencies for 
 41        }
 42
 12443        if ((serverAddress.Transport is string transport && transport != Name) || serverAddress.Params.Count > 0)
 144        {
 145            throw new ArgumentException(
 146                $"The server address '{serverAddress}' contains parameters that are not valid for the QUIC server transp
 147                nameof(serverAddress));
 48        }
 49
 12350        if (serverAuthenticationOptions is null)
 051        {
 052            throw new ArgumentNullException(
 053                nameof(serverAuthenticationOptions),
 054                "The QUIC server transport requires the SSL server authentication options to be set.");
 55        }
 56
 12357        if (serverAddress.Transport is null)
 12258        {
 12259            serverAddress = serverAddress with { Transport = Name };
 12260        }
 61
 12362        return new QuicMultiplexedListener(serverAddress, options, _quicOptions, serverAuthenticationOptions);
 12263    }
 64}