< Summary

Information
Class: IceRpc.OutgoingFieldValue
Assembly: IceRpc
File(s): /home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc/OutgoingFieldValue.cs
Tag: 275_13775359185
Line coverage
100%
Covered lines: 10
Uncovered lines: 0
Coverable lines: 10
Total lines: 37
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage
100%
Covered methods: 4
Total methods: 4
Method coverage: 100%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_ByteSequence()100%11100%
get_WriteAction()100%11100%
.ctor(...)100%11100%
.ctor(...)100%11100%

File(s)

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

#LineLine coverage
 1// Copyright (c) ZeroC, Inc.
 2
 3using System.Buffers;
 4
 5namespace IceRpc;
 6
 7/// <summary>Represents the value of a field that is about to be sent. It's a kind of discriminated union: only one
 8/// of the struct's properties can be set.</summary>
 9public readonly record struct OutgoingFieldValue
 10{
 11    /// <summary>Gets the value of this outgoing field.</summary>
 12    /// <value>The value of this outgoing field. Defaults to an empty byte sequence.</value>
 13    /// <remarks><see cref="ByteSequence" /> is set when the outgoing field value is constructed with <see
 14    /// cref="OutgoingFieldValue(ReadOnlySequence{byte})" />.</remarks>
 2215    public ReadOnlySequence<byte> ByteSequence { get; }
 16
 17    /// <summary>Gets the action used to write the field value. This action is executed when the fields are sent.
 18    /// </summary>
 19    /// <value>The write action of this outgoing field. Defaults to <see langword="null"/>.</value>
 3620    public Action<IBufferWriter<byte>>? WriteAction { get; }
 21
 22    /// <summary>Constructs an outgoing field value that holds a byte sequence.</summary>
 23    /// <param name="byteSequence">The field encoded value.</param>
 24    public OutgoingFieldValue(ReadOnlySequence<byte> byteSequence)
 1325    {
 1326        ByteSequence = byteSequence;
 1327        WriteAction = null;
 1328    }
 29
 30    /// <summary>Constructs an outgoing field value that holds a write action.</summary>
 31    /// <param name="writeAction">The action that writes the field value.</param>
 32    public OutgoingFieldValue(Action<IBufferWriter<byte>> writeAction)
 2833    {
 2834        ByteSequence = default;
 2835        WriteAction = writeAction;
 2836    }
 37}