< Summary

Information
Class: Dotnet.Installer.Core.Types.SnapInfo
Assembly: Dotnet.Installer.Core
File(s): /home/runner/work/dotnet-snap/dotnet-snap/src/Dotnet.Installer.Core/Types/SnapInfo.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 15
Coverable lines: 15
Total lines: 32
Line coverage: 0%
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%210%
get_Name()100%210%
get_Version()100%210%
get_Revision()100%210%
get_Channel()100%210%
get_Publisher()100%210%
ParseVersionAsDotnetVersion()100%210%

File(s)

/home/runner/work/dotnet-snap/dotnet-snap/src/Dotnet.Installer.Core/Types/SnapInfo.cs

#LineLine coverage
 1namespace Dotnet.Installer.Core.Types;
 2
 3/// <summary>
 4/// Publishing information about a snap
 5/// </summary>
 6/// <param name="Name">The snap name</param>
 7/// <param name="Version">String representation of the snap version published in <see cref="Channel"/></param>
 8/// <param name="Revision">A number representing the snap revision published in <see cref="Channel"/></param>
 9/// <param name="Channel">Name of the channel this snap is published to</param>
 10/// <param name="Publisher">Information about the publisher of this snap</param>
 11/// <seealso href="https://snapcraft.io/docs/snapd-api#heading--find"/>
 012public record SnapInfo(
 013    string Name,
 014    string Version,
 015    string Revision,
 016    string Channel,
 017    SnapPublisher Publisher)
 18{
 19    public DotnetVersion ParseVersionAsDotnetVersion()
 020    {
 21        try
 022        {
 023            return DotnetVersion.Parse(Version.Split("+git")[0]);
 24        }
 025        catch (Exception exception)
 026        {
 027            throw new ApplicationException(
 028                message: $"Could not parse .NET version ({Version}) from snap {Name}",
 029                innerException: exception);
 30        }
 031    }
 32}