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

Information
Class: ZhEaIsNsAaBn.Utilities.PrintPDF.PrintPdfErrors
Assembly: ZhEaIsNsAaBn.Utilities.PrintPDF
File(s): /home/runner/work/ZhEaIsNsAaBn.Libraries.V1/ZhEaIsNsAaBn.Libraries.V1/src/UtilitiesPackages/ZhEaIsNsAaBn.Utilities.PrintPDF/PrintPdfErrors.cs
Line coverage
80%
Covered lines: 4
Uncovered lines: 1
Coverable lines: 5
Total lines: 31
Line coverage: 80%
Branch coverage
50%
Covered branches: 1
Total branches: 2
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
BrowserNotStarted(...)100%11100%
UrlNotAllowed(...)50%22100%
PrintFailed(...)100%210%

File(s)

/home/runner/work/ZhEaIsNsAaBn.Libraries.V1/ZhEaIsNsAaBn.Libraries.V1/src/UtilitiesPackages/ZhEaIsNsAaBn.Utilities.PrintPDF/PrintPdfErrors.cs

#LineLine coverage
 1namespace ZhEaIsNsAaBn.Utilities.PrintPDF;
 2
 3/// <summary>Errors returned by <see cref="ChromiumHandler"/>. Type: <c>PrintPdfError</c>.</summary>
 4public static class PrintPdfErrors
 5{
 6    private const string PrintPdfError = nameof( PrintPdfError );
 7
 8
 9    /// <summary>Chromium couldn't be downloaded or started.</summary>
 10    /// <param name="exception">The exception, kept for logs.</param>
 11    /// <returns>The <c>BrowserNotStarted</c> error (severity High).</returns>
 12    public static Error BrowserNotStarted( Exception exception )
 1013        => new( nameof( BrowserNotStarted ), PrintPdfError, "تعذر تشغيل المتصفح لطباعة الملف.", "The browser for printin
 14
 15    /// <summary>The URL isn't <c>http</c>/<c>https</c>, or its host isn't in <see cref="ChromiumOptions.AllowedHosts"/>
 16    /// <param name="url">The refused URL; only its scheme and host are kept (in additional data).</param>
 17    /// <returns>The <c>UrlNotAllowed</c> error (severity High).</returns>
 18    public static Error UrlNotAllowed( Uri url )
 19    {
 1420        ArgumentNullException.ThrowIfNull( url );
 21
 1422        return new Error( nameof( UrlNotAllowed ), PrintPdfError, "عنوان الصفحة غير مسموح بطباعته.", "This address isn't
 1423                          new Dictionary<string, object> { [ "Scheme" ] = url.Scheme, [ "Host" ] = url.IsAbsoluteUri ? u
 24    }
 25
 26    /// <summary>The page couldn't be loaded or printed.</summary>
 27    /// <param name="exception">The exception, kept for logs.</param>
 28    /// <returns>The <c>PrintFailed</c> error (severity Medium).</returns>
 29    public static Error PrintFailed( Exception exception )
 030        => new( nameof( PrintFailed ), PrintPdfError, "تعذرت طباعة الملف بصيغة PDF.", "The PDF couldn't be printed.", Se
 31}