< Summary

Line coverage
100%
Covered lines: 18
Uncovered lines: 0
Coverable lines: 18
Total lines: 29
Line coverage: 100%
Branch coverage
100%
Covered branches: 6
Total branches: 6
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.cctor()100%11100%
Normalize(...)100%66100%

File(s)

/home/runner/work/Studio2Prod/Studio2Prod/AppRepository/ApiServices/StudioApi/Utils/CurrencyNormalizer.cs

#LineLine coverage
 1public static class CurrencyNormalizer
 2{
 13    private static readonly Dictionary<string, string> CurrencyMap = new()
 14    {
 15        { "RUR", "RUB" },
 16        { "RUB", "RUB" },
 17
 18        { "USD", "USD" },
 19        { "EUR", "EUR" },
 110        { "BYN", "BYN" },
 111        { "BYR", "BYN" }
 112    };
 13
 14    public static string? Normalize(string? rawName)
 15    {
 616        if (string.IsNullOrWhiteSpace(rawName))
 217            return null;
 18
 419        rawName = rawName.ToUpperInvariant();
 20
 2721        foreach (var kv in CurrencyMap)
 22        {
 1123            if (rawName.Contains(kv.Key))
 324                return kv.Value;
 25        }
 26
 127        return null;
 328    }
 29}

Methods/Properties

.cctor()
Normalize(System.String)