< Summary

Information
Class: MyNet.Humanizer.Display.TypedDisplayTextStrategyAdapter<T>
Assembly: MyNet.Humanizer
File(s): https://raw.githubusercontent.com/sandre58/MyNet/85372080fe102cd9ee155ceab49ae000e7f66103/src/MyNet.Humanizer/Display/TypedDisplayTextStrategyAdapter.cs
Tag: 323_28699572109
Line coverage
50%
Covered lines: 1
Uncovered lines: 1
Coverable lines: 2
Total lines: 37
Line coverage: 50%
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
GetDisplayText(...)100%11100%
GetDisplayText(...)100%210%

File(s)

https://raw.githubusercontent.com/sandre58/MyNet/85372080fe102cd9ee155ceab49ae000e7f66103/src/MyNet.Humanizer/Display/TypedDisplayTextStrategyAdapter.cs

#LineLine coverage
 1// -----------------------------------------------------------------------
 2// <copyright file="TypedDisplayTextStrategyAdapter.cs" company="Stéphane ANDRE">
 3// Copyright (c) Stéphane ANDRE. All rights reserved.
 4// </copyright>
 5// -----------------------------------------------------------------------
 6
 7using System.Globalization;
 8
 9namespace MyNet.Humanizer.Display;
 10
 11/// <summary>
 12/// Adapter that allows an untyped <see cref="IDisplayTextStrategy"/> to be used as a typed <see cref="IDisplayTextStrat
 13/// </summary>
 14/// <param name="inner">The inner untyped display text strategy.</param>
 15/// <typeparam name="T">The target type for the typed display text strategy.</typeparam>
 16public sealed class TypedDisplayTextStrategyAdapter<T>(IDisplayTextStrategy inner) : IDisplayTextStrategy<T>
 17    where T : notnull
 18{
 19    /// <summary>
 20    /// Gets the display text for the given value using the inner untyped strategy. The value is passed as an object to 
 21    /// </summary>
 22    /// <param name="value">The value for which to get the display text.</param>
 23    /// <param name="options">The display text options.</param>
 24    /// <param name="culture">The culture to use for formatting.</param>
 25    /// <returns>The display text for the given value.</returns>
 1526    public string GetDisplayText(T value, DisplayTextOptions options, CultureInfo culture) => inner.GetDisplayText(value
 27
 28    /// <summary>
 29    /// Gets the display text for the given value using the inner untyped strategy. This method is part of the IDisplayT
 30    /// </summary>
 31    /// <param name="value">The value for which to get the display text.</param>
 32    /// <param name="options">The display text options.</param>
 33    /// <param name="culture">The culture to use for formatting.</param>
 34    /// <returns>The display text for the given value.</returns>
 035    public string GetDisplayText(object value, DisplayTextOptions options, CultureInfo culture) => inner.GetDisplayText(
 36}
 37