< Summary - Envilder .NET SDK

Information
Class: Envilder.ContractValidationResult
Assembly: Envilder
File(s): /home/runner/work/envilder/envilder/src/sdks/dotnet/Domain/ContractValidationResult.cs
Tag: 605_44106794472
Line coverage
100%
Covered lines: 8
Uncovered lines: 0
Coverable lines: 8
Total lines: 37
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
.ctor(...)100%44100%

File(s)

/home/runner/work/envilder/envilder/src/sdks/dotnet/Domain/ContractValidationResult.cs

#LineLine coverage
 1namespace Envilder;
 2
 3using System.Collections.Generic;
 4using System.Linq;
 5
 6/// <summary>
 7/// The outcome of checking a map file contract: the map file is valid and
 8/// every declared secret exists. When the map file is invalid,
 9/// <see cref="Keys"/> is empty because no provider was called.
 10/// </summary>
 11public class ContractValidationResult
 12{
 13  /// <summary>Initializes a new instance.</summary>
 14  /// <param name="mapFileErrors">Every reason the map file cannot be used.</param>
 15  /// <param name="keys">One check per variable of the map file, in map-file order.</param>
 116  public ContractValidationResult(
 117    IReadOnlyList<MapFileError> mapFileErrors,
 118    IReadOnlyList<KeyCheck> keys)
 19  {
 120    MapFileErrors = mapFileErrors;
 121    Keys = keys;
 122    IsValid = mapFileErrors.Count == 0
 123      && keys.All(key => key.Status == SecretExistenceStatus.Exists);
 124  }
 25
 26  /// <summary>
 27  /// <see langword="true"/> when the map file has no errors and every key
 28  /// <see cref="SecretExistenceStatus.Exists"/>.
 29  /// </summary>
 30  public bool IsValid { get; }
 31
 32  /// <summary>Why the map file cannot be used. Empty when it is valid.</summary>
 33  public IReadOnlyList<MapFileError> MapFileErrors { get; }
 34
 35  /// <summary>One check per variable, in map-file order. Empty when the map file is invalid.</summary>
 36  public IReadOnlyList<KeyCheck> Keys { get; }
 37}