< Summary

Information
Class: Chronicis.Api.Services.ExternalLinks.BackgroundCategoryStrategy
Assembly: Chronicis.Api
File(s): /home/runner/work/chronicis/chronicis/src/Chronicis.Api/Services/ExternalLinks/BackgroundCategoryStrategy.cs
Line coverage
100%
Covered lines: 26
Uncovered lines: 0
Coverable lines: 26
Total lines: 52
Line coverage: 100%
Branch coverage
100%
Covered branches: 10
Total branches: 10
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_CategoryKey()100%11100%
get_Endpoint()100%11100%
get_DisplayName()100%11100%
get_Icon()100%11100%
BuildMarkdown(...)100%1010100%

File(s)

/home/runner/work/chronicis/chronicis/src/Chronicis.Api/Services/ExternalLinks/BackgroundCategoryStrategy.cs

#LineLine coverage
 1using System.Text;
 2using System.Text.Json;
 3using static Chronicis.Api.Services.ExternalLinks.Open5eJsonHelpers;
 4
 5namespace Chronicis.Api.Services.ExternalLinks;
 6
 7public sealed class BackgroundCategoryStrategy : Open5eCategoryStrategyBase
 8{
 99    public override string CategoryKey => "backgrounds";
 210    public override string Endpoint => "backgrounds";
 411    public override string DisplayName => "Background";
 212    public override string? Icon => "📜";
 13
 14    public override string BuildMarkdown(JsonElement root, string title)
 15    {
 416        var sb = new StringBuilder();
 417        sb.AppendLine($"# {title}");
 418        sb.AppendLine();
 19
 420        var desc = GetString(root, "desc");
 421        if (!string.IsNullOrEmpty(desc))
 22        {
 223            sb.AppendLine(desc);
 224            sb.AppendLine();
 25        }
 26
 427        var skillProf = GetString(root, "skill_proficiencies");
 428        if (!string.IsNullOrEmpty(skillProf))
 29        {
 130            sb.AppendLine($"**Skill Proficiencies:** {skillProf}");
 131            sb.AppendLine();
 32        }
 33
 434        var equipment = GetString(root, "equipment");
 435        if (!string.IsNullOrEmpty(equipment))
 36        {
 137            sb.AppendLine($"**Equipment:** {equipment}");
 138            sb.AppendLine();
 39        }
 40
 441        var featureName = GetString(root, "feature");
 442        var featureDesc = GetString(root, "feature_desc");
 443        if (!string.IsNullOrEmpty(featureName))
 44        {
 245            sb.AppendLine($"## {featureName}");
 246            if (!string.IsNullOrEmpty(featureDesc))
 147                sb.AppendLine(featureDesc);
 48        }
 49
 450        return sb.ToString().Trim();
 51    }
 52}