< Summary

Information
Class: IceRpc.Transports.Coloc.ColocTransport
Assembly: IceRpc.Transports.Coloc
File(s): /home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc.Transports.Coloc/ColocTransport.cs
Tag: 2300_35243572715
Line coverage
75%
Covered lines: 12
Uncovered lines: 4
Coverable lines: 16
Total lines: 47
Line coverage: 75%
Branch coverage
50%
Covered branches: 1
Total branches: 2
Branch coverage: 50%
Method coverage
100%
Covered methods: 4
Fully covered methods: 3
Total methods: 4
Method coverage: 100%
Full method coverage: 75%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_ClientTransport()100%11100%
get_ServerTransport()100%11100%
.ctor()100%11100%
.ctor(...)50%2263.63%

File(s)

/home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc.Transports.Coloc/ColocTransport.cs

#LineLine coverage
 1// Copyright (c) ZeroC, Inc.
 2
 3using IceRpc.Transports.Coloc.Internal;
 4using System.Collections.Concurrent;
 5
 6namespace IceRpc.Transports.Coloc;
 7
 8/// <summary>The Coloc transport class provides a client and server duplex transport that can be used for in-process
 9/// communications.</summary>
 10public sealed class ColocTransport
 11{
 12    /// <summary>The transport name.</summary>
 13    public const string Name = "coloc";
 14
 15    /// <summary>Gets the colocated client transport.</summary>
 16    /// <value>The client transport.</value>
 57917    public IDuplexClientTransport ClientTransport { get; }
 18
 19    /// <summary>Gets the colocated server transport.</summary>
 20    /// <value>The server transport.</value>
 58621    public IDuplexServerTransport ServerTransport { get; }
 22
 23    /// <summary>Constructs a <see cref="ColocTransport" />.</summary>
 24    public ColocTransport()
 3725        : this(new ColocTransportOptions())
 3726    {
 3727    }
 28
 29    /// <summary>Constructs a <see cref="ColocTransport" />.</summary>
 30    /// <param name="options">The options to configure the Coloc transport.</param>
 31    /// <exception cref="ArgumentException">Thrown when the <see cref="ColocTransportOptions.ResumeWriterThreshold" />
 32    /// of <paramref name="options" /> is greater than its <see cref="ColocTransportOptions.PauseWriterThreshold"
 33    /// />.</exception>
 56834    public ColocTransport(ColocTransportOptions options)
 56835    {
 56836        if (options.ResumeWriterThreshold > options.PauseWriterThreshold)
 037        {
 038            throw new ArgumentException(
 039                $"The value of {nameof(ColocTransportOptions.ResumeWriterThreshold)} cannot be greater than the value of
 040                nameof(options));
 41        }
 42
 56843        var listeners = new ConcurrentDictionary<(string Host, ushort Port), ColocListener>();
 56844        ClientTransport = new ColocClientTransport(listeners, options);
 56845        ServerTransport = new ColocServerTransport(listeners, options);
 56846    }
 47}