< Summary

Information
Class: MyNet.Humanizer.Display.Strategies.SmartEnumDisplayTextStrategy
Assembly: MyNet.Humanizer
File(s): https://raw.githubusercontent.com/sandre58/MyNet/85372080fe102cd9ee155ceab49ae000e7f66103/src/MyNet.Humanizer/Display/Strategies/SmartEnumDisplayTextStrategy.cs
Tag: 323_28699572109
Line coverage
75%
Covered lines: 3
Uncovered lines: 1
Coverable lines: 4
Total lines: 30
Line coverage: 75%
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%
ProvideSymbol(...)100%210%
ProvideDisplayText(...)100%11100%
ProvideFallback(...)100%11100%

File(s)

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

#LineLine coverage
 1// -----------------------------------------------------------------------
 2// <copyright file="SmartEnumDisplayTextStrategy.cs" company="Stéphane ANDRE">
 3// Copyright (c) Stéphane ANDRE. All rights reserved.
 4// </copyright>
 5// -----------------------------------------------------------------------
 6
 7using System.Globalization;
 8using MyNet.Globalization.Localization.Translation;
 9using MyNet.Globalization.Localization.Translation.KeyGeneration;
 10using MyNet.Primitives;
 11
 12namespace MyNet.Humanizer.Display.Strategies;
 13
 14/// <summary>
 15/// Provides display names for SmartEnum values, using a translation service to support localization. It first attempts 
 16/// </summary>
 17/// <param name="translationService">The translation service used to localize the display names.</param>
 18/// <param name="keyProvider">The key provider to use for generating translation keys.</param>
 819public sealed class SmartEnumDisplayTextStrategy(ITranslationService translationService, ITranslationKeyProvider keyProv
 20{
 21    /// <inheritdoc/>
 022    protected override string? ProvideSymbol(ISmartEnum value, CultureInfo culture) => null;
 23
 24    /// <inheritdoc/>
 1225    protected override string? ProvideDisplayText(ISmartEnum value, CultureInfo culture) => null;
 26
 27    /// <inheritdoc/>
 1228    protected override string ProvideFallback(ISmartEnum value, CultureInfo culture) => value.Name;
 29}
 30