< Summary

Information
Class: AsiBackbone.AspNetCore.Handshakes.AsiBackboneAcknowledgmentChallengeResult
Assembly: AsiBackbone.AspNetCore
File(s): /home/runner/work/AsiBackbone/AsiBackbone/src/AsiBackbone.AspNetCore/Handshakes/AsiBackboneAcknowledgmentChallengeResult.cs
Line coverage
100%
Covered lines: 15
Uncovered lines: 0
Coverable lines: 15
Total lines: 68
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%11100%
get_Result()100%11100%
get_Acknowledgment()100%11100%
get_Succeeded()100%11100%
get_Acknowledged()100%22100%
get_Rejected()100%22100%
Success(...)100%11100%
Failure(...)100%11100%

File(s)

/home/runner/work/AsiBackbone/AsiBackbone/src/AsiBackbone.AspNetCore/Handshakes/AsiBackboneAcknowledgmentChallengeResult.cs

#LineLine coverage
 1using AsiBackbone.Core.Handshakes;
 2using AsiBackbone.Core.Results;
 3
 4namespace AsiBackbone.AspNetCore.Handshakes;
 5
 6/// <summary>
 7/// Represents the result of handling a host-submitted acknowledgment challenge response.
 8/// </summary>
 9public sealed class AsiBackboneAcknowledgmentChallengeResult
 10{
 2611    private AsiBackboneAcknowledgmentChallengeResult(
 2612        OperationResult result,
 2613        LiabilityHandshakeAcknowledgment? acknowledgment)
 14    {
 2615        ArgumentNullException.ThrowIfNull(result);
 16
 2617        Result = result;
 2618        Acknowledgment = acknowledgment;
 2619    }
 20
 21    /// <summary>
 22    /// Gets the operation result describing response handling success or failure.
 23    /// </summary>
 4624    public OperationResult Result { get; }
 25
 26    /// <summary>
 27    /// Gets the Core acknowledgment response when one was created.
 28    /// </summary>
 6629    public LiabilityHandshakeAcknowledgment? Acknowledgment { get; }
 30
 31    /// <summary>
 32    /// Gets a value indicating whether the response was handled successfully.
 33    /// </summary>
 2634    public bool Succeeded => Result.Succeeded;
 35
 36    /// <summary>
 37    /// Gets a value indicating whether the response was accepted by the actor.
 38    /// </summary>
 1039    public bool Acknowledged => Acknowledgment?.Acknowledged == true;
 40
 41    /// <summary>
 42    /// Gets a value indicating whether the response was rejected by the actor.
 43    /// </summary>
 1044    public bool Rejected => Acknowledgment?.Rejected == true;
 45
 46    /// <summary>
 47    /// Creates a successful acknowledgment challenge result.
 48    /// </summary>
 49    /// <param name="acknowledgment">The Core acknowledgment response.</param>
 50    /// <returns>A successful challenge result.</returns>
 51    public static AsiBackboneAcknowledgmentChallengeResult Success(LiabilityHandshakeAcknowledgment acknowledgment)
 52    {
 853        ArgumentNullException.ThrowIfNull(acknowledgment);
 54
 655        return new AsiBackboneAcknowledgmentChallengeResult(OperationResult.Success(), acknowledgment);
 56    }
 57
 58    /// <summary>
 59    /// Creates a failed acknowledgment challenge result.
 60    /// </summary>
 61    /// <param name="code">The failure reason code.</param>
 62    /// <param name="message">The failure reason message.</param>
 63    /// <returns>A failed challenge result.</returns>
 64    public static AsiBackboneAcknowledgmentChallengeResult Failure(string code, string message)
 65    {
 2066        return new AsiBackboneAcknowledgmentChallengeResult(OperationResult.Failure(code, message), null);
 67    }
 68}