< Summary

Information
Class: Amusoft.DotnetNew.Tests.Diagnostics.BuildResult
Assembly: Amusoft.DotnetNew.Tests
File(s): /home/runner/work/Amusoft.DotnetNew.Tests/Amusoft.DotnetNew.Tests/src/Amusoft.DotnetNew.Tests/Diagnostics/BuildResult.cs
Tag: 127_14865883074
Line coverage
100%
Covered lines: 23
Uncovered lines: 0
Coverable lines: 23
Total lines: 44
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
.cctor()100%11100%
GetDlls()100%11100%
Print(...)100%11100%

File(s)

/home/runner/work/Amusoft.DotnetNew.Tests/Amusoft.DotnetNew.Tests/src/Amusoft.DotnetNew.Tests/Diagnostics/BuildResult.cs

#LineLine coverage
 1using System.Collections.Generic;
 2using System.Linq;
 3using System.Text;
 4using System.Text.Json;
 5using System.Text.RegularExpressions;
 6using Amusoft.DotnetNew.Tests.Interfaces;
 7using Amusoft.DotnetNew.Tests.Templating;
 8using Amusoft.DotnetNew.Tests.Utility;
 9
 10namespace Amusoft.DotnetNew.Tests.Diagnostics;
 11
 212internal class BuildResult(
 213  string command,
 214  string content
 215) : ICommandResult
 16{
 117  private static readonly Regex Regex = new(@"-(?:>) (?<dll>.+?\.dll)", RegexOptions.Compiled);
 18
 19  private IEnumerable<string> GetDlls()
 20  {
 221    var matchCollection = Regex.Matches(content);
 222    return matchCollection
 823      .Select(d => d.Groups["dll"].Value)
 824      .OrderBy(d => d)
 1025      .Select(d => new CrossPlatformPath(d).VirtualPath);
 26  }
 27
 28  public void Print(StringBuilder stringBuilder)
 29  {
 230    var serializeContent = new
 231    {
 232      Command = command,
 233      Files = GetDlls(),
 234    };
 235    var serialized = JsonSerializer.Serialize(serializeContent,new JsonSerializerOptions()
 236      {
 237        WriteIndented = true,
 238        Encoder = CustomJsonEncoder.Instance
 239      }
 240    );
 41
 242    stringBuilder.Append(TemplatingDefaults.Instance.PrintPattern("BuildResult", serialized));
 243  }
 44}