< Summary

Information
Class: NexusLabs.Needlr.ContainerVerificationException
Assembly: NexusLabs.Needlr
File(s): /home/runner/work/needlr/needlr/src/NexusLabs.Needlr/ContainerVerificationException.cs
Line coverage
100%
Covered lines: 10
Uncovered lines: 0
Coverable lines: 10
Total lines: 36
Line coverage: 100%
Branch coverage
100%
Covered branches: 2
Total branches: 2
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_Issues()100%11100%
.ctor(...)100%11100%
FormatMessage(...)100%22100%

File(s)

/home/runner/work/needlr/needlr/src/NexusLabs.Needlr/ContainerVerificationException.cs

#LineLine coverage
 1namespace NexusLabs.Needlr;
 2
 3/// <summary>
 4/// Exception thrown when container verification fails with issues configured to throw.
 5/// </summary>
 6public sealed class ContainerVerificationException : Exception
 7{
 8    /// <summary>
 9    /// Gets the verification issues that caused this exception.
 10    /// </summary>
 711    public IReadOnlyList<VerificationIssue> Issues { get; }
 12
 13    /// <summary>
 14    /// Creates a new container verification exception.
 15    /// </summary>
 16    /// <param name="issues">The verification issues that caused the exception.</param>
 17    public ContainerVerificationException(IReadOnlyList<VerificationIssue> issues)
 518        : base(FormatMessage(issues))
 19    {
 520        Issues = issues;
 521    }
 22
 23    private static string FormatMessage(IReadOnlyList<VerificationIssue> issues)
 24    {
 1125        var grouped = issues.GroupBy(i => i.Type);
 526        var parts = new List<string>();
 27
 2028        foreach (var group in grouped)
 29        {
 530            parts.Add($"{group.Count()} {group.Key} issue(s)");
 31        }
 32
 533        return $"Container verification failed: {string.Join(", ", parts)}. " +
 534               $"See the {nameof(Issues)} property for details.";
 35    }
 36}