< Summary - ZhEaIsNsAaBn.Libraries coverage (affected: 23 packages)

Information
Class: ZhEaIsNsAaBn.Utilities.ValidationResponses.ValidationResponse
Assembly: ZhEaIsNsAaBn.Utilities.ValidationResponses
File(s): /home/runner/work/ZhEaIsNsAaBn.Libraries.V1/ZhEaIsNsAaBn.Libraries.V1/src/UtilitiesPackages/ZhEaIsNsAaBn.Utilities.ValidationResponses/ValidationResponse.cs
Line coverage
100%
Covered lines: 13
Uncovered lines: 0
Coverable lines: 13
Total lines: 53
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_IsValid()100%11100%
op_Implicit(...)100%11100%
op_Implicit(...)100%11100%
op_Implicit(...)100%11100%

File(s)

/home/runner/work/ZhEaIsNsAaBn.Libraries.V1/ZhEaIsNsAaBn.Libraries.V1/src/UtilitiesPackages/ZhEaIsNsAaBn.Utilities.ValidationResponses/ValidationResponse.cs

#LineLine coverage
 1namespace ZhEaIsNsAaBn.Utilities.ValidationResponses;
 2
 3/// <summary>
 4///     Represents a validation response that contains validation errors and provides validation status.
 5///     Supports implicit conversion from various error types for convenient usage.
 6/// </summary>
 7public class ValidationResponse
 8{
 9    /// <summary>
 10    ///     Gets or sets the list of validation errors.
 11    /// </summary>
 12    /// <value>The validation errors. Empty when the row is valid; never <see langword="null"/>.</value>
 13    public List<ColumnValidationError> Errors { get; set; } = [];
 14
 15    /// <summary>
 16    ///     Gets a value indicating whether the validation is successful (no errors).
 17    /// </summary>
 18    /// <value><c>true</c> if there are no validation errors; otherwise, <c>false</c>.</value>
 3019    public bool IsValid => Errors.Count == 0;
 20
 21    /// <summary>
 22    ///     Implicitly converts a list of validation errors to a <see cref="ValidationResponse" />.
 23    /// </summary>
 24    /// <param name="errors">The list of validation errors to convert.</param>
 25    /// <returns>A new <see cref="ValidationResponse" /> instance containing the specified errors.</returns>
 26    public static implicit operator ValidationResponse( List<ColumnValidationError> errors ) =>
 627        new()
 628            {
 629                Errors = errors
 630            };
 31
 32    /// <summary>
 33    ///     Implicitly converts an array of validation errors to a <see cref="ValidationResponse" />.
 34    /// </summary>
 35    /// <param name="errors">The array of validation errors to convert.</param>
 36    /// <returns>A new <see cref="ValidationResponse" /> instance containing the specified errors.</returns>
 37    public static implicit operator ValidationResponse( ColumnValidationError[] errors ) =>
 338        new()
 339            {
 340                Errors = errors.ToList()
 341            };
 42
 43    /// <summary>
 44    ///     Implicitly converts a single validation error to a <see cref="ValidationResponse" />.
 45    /// </summary>
 46    /// <param name="errors">The validation error to convert.</param>
 47    /// <returns>A new <see cref="ValidationResponse" /> instance containing the specified error.</returns>
 48    public static implicit operator ValidationResponse( ColumnValidationError errors ) =>
 349        new()
 350            {
 351                Errors = [errors]
 352            };
 53}