< Summary

Information
Class: MyNet.Humanizer.Facade.QuantifyExtensions
Assembly: MyNet.Humanizer
File(s): https://raw.githubusercontent.com/sandre58/MyNet/85372080fe102cd9ee155ceab49ae000e7f66103/src/MyNet.Humanizer/Facade/Extensions/QuantifyExtensions.cs
Tag: 323_28699572109
Line coverage
100%
Covered lines: 2
Uncovered lines: 0
Coverable lines: 2
Total lines: 40
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
Humanize(...)100%11100%
Humanize(...)100%11100%

File(s)

https://raw.githubusercontent.com/sandre58/MyNet/85372080fe102cd9ee155ceab49ae000e7f66103/src/MyNet.Humanizer/Facade/Extensions/QuantifyExtensions.cs

#LineLine coverage
 1// -----------------------------------------------------------------------
 2// <copyright file="QuantifyExtensions.cs" company="Stéphane ANDRE">
 3// Copyright (c) Stéphane ANDRE. All rights reserved.
 4// </copyright>
 5// -----------------------------------------------------------------------
 6
 7using System;
 8using MyNet.Globalization.Localization.Translation;
 9using MyNet.Humanizer.Display;
 10using MyNet.Primitives.Conversion;
 11
 12#pragma warning disable IDE0130 // Namespace does not match folder structure
 13namespace MyNet.Humanizer.Facade;
 14#pragma warning restore IDE0130 // Namespace does not match folder structure
 15
 16/// <summary>
 17/// Provides extensions for formatting a <see cref="string"/> word as a quantity.
 18/// </summary>
 19public static class QuantifyExtensions
 20{
 21    extension<TUnit>(Quantity<TUnit> quantity)
 22        where TUnit : struct, Enum
 23    {
 24        /// <summary>
 25        /// Formats the quantity by humanizing the unit and quantifying the value. The method uses the default display s
 26        /// </summary>
 27        /// <param name="format">A standard or custom numeric format string.</param>
 28        /// <returns>The formatted quantity string.</returns>
 1229        public string Humanize(string? format = null) => quantity.Humanize(DisplayStyle.Default, format);
 30
 31        /// <summary>
 32        /// Formats the quantity by humanizing the unit and quantifying the value. The method first humanizes the unit u
 33        /// </summary>
 34        /// <param name="style">The display style to use when humanizing the unit.</param>
 35        /// <param name="format">A standard or custom numeric format string.</param>
 36        /// <returns>The formatted quantity string.</returns>
 2137        public string Humanize(DisplayStyle style, string? format = null) => quantity.Unit.Humanize(new DisplayTextOptio
 38    }
 39}
 40