< Summary

Information
Class: AsiBackbone.Core.Evaluation.AsiBackbonePolicyEvaluatorOptions
Assembly: AsiBackbone.Core
File(s): /home/runner/work/AsiBackbone/AsiBackbone/src/AsiBackbone.Core/Evaluation/AsiBackbonePolicyEvaluatorOptions.cs
Line coverage
100%
Covered lines: 9
Uncovered lines: 0
Coverable lines: 9
Total lines: 60
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
get_DenyWhenNoConstraints()100%11100%
get_ShortCircuitOnFirstDenial()100%11100%
get_NoConstraintsReasonCode()100%11100%
get_NoConstraintsReasonMessage()100%11100%
Validate()100%44100%

File(s)

/home/runner/work/AsiBackbone/AsiBackbone/src/AsiBackbone.Core/Evaluation/AsiBackbonePolicyEvaluatorOptions.cs

#LineLine coverage
 1namespace AsiBackbone.Core.Evaluation;
 2
 3/// <summary>
 4/// Provides host-configurable options for the default AsiBackbone policy evaluator.
 5/// </summary>
 6public sealed class AsiBackbonePolicyEvaluatorOptions
 7{
 8    private const string DefaultNoConstraintsReasonMessage =
 9        "No policy constraints were registered or supplied for evaluation.";
 10
 11    /// <summary>
 12    /// Gets the default machine-readable reason code used when strict empty-policy evaluation denies execution.
 13    /// </summary>
 14    public const string DefaultNoConstraintsReasonCode = "asibackbone.policy.no_constraints";
 15
 16    /// <summary>
 17    /// Gets or sets a value indicating whether evaluation should deny when no constraints are registered or supplied.
 18    /// </summary>
 19    /// <remarks>
 20    /// The default value is <see langword="false" /> for backward compatibility with hosts that intentionally run
 21    /// permissive or explicitly unconstrained evaluation flows.
 22    /// </remarks>
 1523    public bool DenyWhenNoConstraints { get; set; }
 24
 25    /// <summary>
 26    /// Gets or sets a value indicating whether evaluation should stop after the first denied constraint result.
 27    /// </summary>
 28    /// <remarks>
 29    /// The default value is <see langword="false" /> so the evaluator continues to collect the complete set of
 30    /// warning and denial reasons for audit visibility. Set this to <see langword="true" /> only when the host
 31    /// intentionally prefers latency-optimized fast-abort behavior over full reason-code aggregation.
 32    /// </remarks>
 4233    public bool ShortCircuitOnFirstDenial { get; set; }
 34
 35    /// <summary>
 36    /// Gets or sets the machine-readable reason code used when <see cref="DenyWhenNoConstraints" /> denies an empty pol
 37    /// </summary>
 8338    public string NoConstraintsReasonCode { get; set; } = DefaultNoConstraintsReasonCode;
 39
 40    /// <summary>
 41    /// Gets or sets the reason message used when <see cref="DenyWhenNoConstraints" /> denies an empty policy.
 42    /// </summary>
 8043    public string NoConstraintsReasonMessage { get; set; } = DefaultNoConstraintsReasonMessage;
 44
 45    /// <summary>
 46    /// Validates evaluator options.
 47    /// </summary>
 48    public void Validate()
 49    {
 3850        if (string.IsNullOrWhiteSpace(NoConstraintsReasonCode))
 51        {
 352            throw new InvalidOperationException($"{nameof(NoConstraintsReasonCode)} must not be empty.");
 53        }
 54
 3555        if (string.IsNullOrWhiteSpace(NoConstraintsReasonMessage))
 56        {
 357            throw new InvalidOperationException($"{nameof(NoConstraintsReasonMessage)} must not be empty.");
 58        }
 3259    }
 60}