< Summary

Information
Class: IceRpc.Transports.Quic.QuicServerTransport
Assembly: IceRpc.Transports.Quic
File(s): /home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc.Transports.Quic/QuicServerTransport.cs
Tag: 275_13775359185
Line coverage
64%
Covered lines: 16
Uncovered lines: 9
Coverable lines: 25
Total lines: 59
Line coverage: 64%
Branch coverage
75%
Covered branches: 9
Total branches: 12
Branch coverage: 75%
Method coverage
75%
Covered methods: 3
Total methods: 4
Method coverage: 75%

Metrics

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

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;
 6
 7namespace IceRpc.Transports.Quic;
 8
 9/// <summary>Implements <see cref="IMultiplexedServerTransport"/> using QUIC.</summary>
 10public class QuicServerTransport : IMultiplexedServerTransport
 11{
 12    /// <inheritdoc/>
 24413    public string Name => "quic";
 14
 15    private readonly QuicServerTransportOptions _quicOptions;
 16
 17    /// <summary>Constructs a QUIC server transport.</summary>
 18    /// <param name="options">The options to configure the transport.</param>
 48819    public QuicServerTransport(QuicServerTransportOptions options) => _quicOptions = options;
 20
 21    /// <summary>Constructs a QUIC server transport.</summary>
 22    public QuicServerTransport()
 023        : this(new QuicServerTransportOptions())
 024    {
 025    }
 26
 27    /// <inheritdoc/>
 28    public IListener<IMultiplexedConnection> Listen(
 29        ServerAddress serverAddress,
 30        MultiplexedConnectionOptions options,
 31        SslServerAuthenticationOptions? serverAuthenticationOptions)
 24632    {
 24633        if (!QuicConnection.IsSupported)
 034        {
 035            throw new NotSupportedException("The Quic server transport is not supported on this platform.");
 36        }
 37
 24638        if ((serverAddress.Transport is string transport && transport != Name) || serverAddress.Params.Count > 0)
 239        {
 240            throw new ArgumentException(
 241                $"The server address '{serverAddress}' contains parameters that are not valid for the Quic server transp
 242                nameof(serverAddress));
 43        }
 44
 24445        if (serverAuthenticationOptions is null)
 046        {
 047            throw new ArgumentNullException(
 048                nameof(serverAuthenticationOptions),
 049                "The Quic server transport requires the Ssl server authentication options to be set.");
 50        }
 51
 24452        if (serverAddress.Transport is null)
 24253        {
 24254            serverAddress = serverAddress with { Transport = Name };
 24255        }
 56
 24457        return new QuicMultiplexedListener(serverAddress, options, _quicOptions, serverAuthenticationOptions);
 24258    }
 59}