< Summary

Information
Class: MyNet.Text.Truncation.TextTruncationOptions
Assembly: MyNet.Text
File(s): https://raw.githubusercontent.com/sandre58/MyNet/85372080fe102cd9ee155ceab49ae000e7f66103/src/MyNet.Text/Truncation/TextTruncationOptions.cs
Tag: 323_28699572109
Line coverage
100%
Covered lines: 2
Uncovered lines: 0
Coverable lines: 2
Total lines: 41
Line coverage: 100%
Branch coverage
100%
Covered branches: 4
Total branches: 4
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
set_Length(...)100%22100%
set_TruncationString(...)100%22100%

File(s)

https://raw.githubusercontent.com/sandre58/MyNet/85372080fe102cd9ee155ceab49ae000e7f66103/src/MyNet.Text/Truncation/TextTruncationOptions.cs

#LineLine coverage
 1// -----------------------------------------------------------------------
 2// <copyright file="TextTruncationOptions.cs" company="Stéphane ANDRE">
 3// Copyright (c) Stéphane ANDRE. All rights reserved.
 4// </copyright>
 5// -----------------------------------------------------------------------
 6
 7using System;
 8
 9namespace MyNet.Text.Truncation;
 10
 11/// <summary>
 12/// Options for truncating text. This is used to specify the length to truncate to, the string to truncate with and the 
 13/// </summary>
 14public sealed record TextTruncationOptions
 15{
 16    /// <summary>
 17    /// Gets the length to truncate to. This is the total length of the truncated string, including the truncation strin
 18    /// </summary>
 19    public required int Length
 20    {
 21        get;
 30022        init => field = value < 0 ? throw new ArgumentOutOfRangeException(nameof(value), "Length must be greater than or
 23    }
 24
 25    /// <summary>
 26    /// Gets the string to use for truncation. This will be appended to the truncated string if the input string is long
 27    /// </summary>
 28    public string TruncationString
 29    {
 30        get;
 29431        init => field = value ?? throw new ArgumentNullException(nameof(value));
 32    }
 33
 34        = "…";
 35
 36    /// <summary>
 37    /// Gets the direction from which to truncate the string. This can be from the left or the right.
 38    /// </summary>
 39    public TruncateFrom Direction { get; init; } = TruncateFrom.Right;
 40}
 41