< Summary

Information
Class: MyNet.UI.Helpers.ApplicationHelper
Assembly: MyNet.UI
File(s): https://raw.githubusercontent.com/sandre58/MyNet/85372080fe102cd9ee155ceab49ae000e7f66103/src/MyNet.UI/Helpers/ApplicationHelper.cs
Tag: 323_28699572109
Line coverage
100%
Covered lines: 10
Uncovered lines: 0
Coverable lines: 10
Total lines: 66
Line coverage: 100%
Branch coverage
50%
Covered branches: 15
Total branches: 30
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.cctor()100%11100%
GetProductName()50%66100%
GetVersion()50%66100%
GetCopyright()50%66100%
GetCompany()50%66100%
GetDescription()50%66100%

File(s)

https://raw.githubusercontent.com/sandre58/MyNet/85372080fe102cd9ee155ceab49ae000e7f66103/src/MyNet.UI/Helpers/ApplicationHelper.cs

#LineLine coverage
 1// -----------------------------------------------------------------------
 2// <copyright file="ApplicationHelper.cs" company="Stéphane ANDRE">
 3// Copyright (c) Stéphane ANDRE. All rights reserved.
 4// </copyright>
 5// -----------------------------------------------------------------------
 6
 7using System;
 8using System.Globalization;
 9using System.Reflection;
 10using MyNet.Primitives;
 11using MyNet.UI.Resources;
 12
 13namespace MyNet.UI.Helpers;
 14
 15public static class ApplicationHelper
 16{
 317    private static readonly Lazy<Assembly?> EntryAssembly = new(static () => Assembly.GetEntryAssembly());
 18
 19    /// <summary>
 20    /// Gets the product name of the application from the assembly's product attribute. Returns an empty string if not f
 21    /// </summary>
 22    /// <returns>The product name of the application.</returns>
 23    public static string GetProductName()
 24    {
 3625        var productAttr = EntryAssembly.Value?.GetCustomAttribute<AssemblyProductAttribute>();
 3626        return productAttr?.Product ?? string.Empty;
 27    }
 28
 29    /// <summary>
 30    /// Gets the version of the application from the assembly's version information. Returns an empty string if not foun
 31    /// </summary>
 32    /// <returns>The version of the application.</returns>
 33    public static string GetVersion()
 3634        => UiResources.VersionAbbrX.FormatWith(CultureInfo.CurrentCulture, EntryAssembly.Value?.GetName().Version?.ToStr
 35
 36    /// <summary>
 37    /// Gets the copyright information of the application from the assembly's copyright attribute. Returns an empty stri
 38    /// </summary>
 39    /// <returns>The copyright information of the application.</returns>
 40    public static string GetCopyright()
 41    {
 3642        var attr = EntryAssembly.Value?.GetCustomAttribute<AssemblyCopyrightAttribute>();
 3643        return attr?.Copyright ?? string.Empty;
 44    }
 45
 46    /// <summary>
 47    /// Gets the company information of the application from the assembly's company attribute. Returns an empty string i
 48    /// </summary>
 49    /// <returns>The company information of the application.</returns>
 50    public static string GetCompany()
 51    {
 3652        var attr = EntryAssembly.Value?.GetCustomAttribute<AssemblyCompanyAttribute>();
 3653        return attr?.Company ?? string.Empty;
 54    }
 55
 56    /// <summary>
 57    /// Gets the description of the application from the assembly's description attribute. Returns an empty string if no
 58    /// </summary>
 59    /// <returns>The description of the application.</returns>
 60    public static string GetDescription()
 61    {
 3662        var attr = EntryAssembly.Value?.GetCustomAttribute<AssemblyDescriptionAttribute>();
 3663        return attr?.Description ?? string.Empty;
 64    }
 65}
 66