< Summary

Information
Class: Services.BitrixStockServices.Stage5CatalogSourceExtensions
Assembly: Services
File(s): /home/runner/work/Studio2Prod/Studio2Prod/AppRepository/BitrixStockServices/Stage5CatalogSource.cs
Line coverage
100%
Covered lines: 8
Uncovered lines: 0
Coverable lines: 8
Total lines: 29
Line coverage: 100%
Branch coverage
83%
Covered branches: 5
Total branches: 6
Branch coverage: 83.3%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
Parse(...)75%44100%
ToLogLabel(...)100%22100%

File(s)

/home/runner/work/Studio2Prod/Studio2Prod/AppRepository/BitrixStockServices/Stage5CatalogSource.cs

#LineLine coverage
 1namespace Services.BitrixStockServices;
 2
 3/// <summary>Источник каталога для этапа 5 BitrixStock.</summary>
 4public enum Stage5CatalogSource
 5{
 6    /// <summary>Каталог из OzonApi.ozon_products + остатки через Ozon API.</summary>
 7    OzonProductsDb = 0,
 8
 9    /// <summary>Legacy: xlsx-отчёт POST /v1/report/warehouse/stock.</summary>
 10    WarehouseStockReport = 1
 11}
 12
 13public static class Stage5CatalogSourceExtensions
 14{
 15    public static Stage5CatalogSource Parse(string? value)
 16    {
 417        if (string.IsNullOrWhiteSpace(value))
 218            return Stage5CatalogSource.OzonProductsDb;
 19
 220        return Enum.TryParse<Stage5CatalogSource>(value, ignoreCase: true, out var parsed)
 221            ? parsed
 222            : Stage5CatalogSource.OzonProductsDb;
 23    }
 24
 25    public static string ToLogLabel(this Stage5CatalogSource source) =>
 226        source == Stage5CatalogSource.WarehouseStockReport
 227            ? "Ozon xlsx warehouse/stock (legacy)"
 228            : "OzonApi.ozon_products + остатки Ozon API";
 29}