< Summary

Information
Class: Services.FeedPriceServices.FeedCabinets
Assembly: Services
File(s): /home/runner/work/Studio2Prod/Studio2Prod/AppRepository/FeedPriceServices/FeedCabinets.cs
Line coverage
90%
Covered lines: 10
Uncovered lines: 1
Coverable lines: 11
Total lines: 29
Line coverage: 90.9%
Branch coverage
91%
Covered branches: 11
Total branches: 12
Branch coverage: 91.6%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
DisplayName(...)75%4483.33%
ForClientName(...)100%88100%

File(s)

/home/runner/work/Studio2Prod/Studio2Prod/AppRepository/FeedPriceServices/FeedCabinets.cs

#LineLine coverage
 1namespace Services.FeedPriceServices;
 2
 3/// <summary>Кабинеты фида: ключ в БД фида → название, под которым его знают в Studio2.</summary>
 4public static class FeedCabinets
 5{
 6    public const string DefaultKey = "default";
 7    public const string Cabinet2Key = "cabinet2";
 8
 459    public static string DisplayName(string cabinetKey) => cabinetKey switch
 4510    {
 811        Cabinet2Key => "Интерпартс",
 3712        DefaultKey => "Interparts RU",
 013        _ => cabinetKey
 4514    };
 15
 16    /// <summary>
 17    /// Кабинет фида клиента маркетплейса. Связи в БД нет, названия кабинетов совпадают с именами клиентов Ozon
 18    /// («Interparts RU» → default, «Интерпартс» → cabinet2); null — клиент не сопоставлен.
 19    /// </summary>
 20    public static string? ForClientName(string? clientName)
 21    {
 3422        var name = clientName?.Trim();
 3723        if (string.IsNullOrEmpty(name)) return null;
 24
 5425        if (string.Equals(name, DisplayName(DefaultKey), StringComparison.OrdinalIgnoreCase)) return DefaultKey;
 1326        if (string.Equals(name, DisplayName(Cabinet2Key), StringComparison.OrdinalIgnoreCase)) return Cabinet2Key;
 327        return null;
 28    }
 29}