< Summary

Information
Class: Services.LabelServices.OzonOrderSplitConfig
Assembly: Services
File(s): /home/runner/work/Studio2Prod/Studio2Prod/AppRepository/LabelServices/OzonOrderSplitConfig.cs
Line coverage
100%
Covered lines: 13
Uncovered lines: 0
Coverable lines: 13
Total lines: 35
Line coverage: 100%
Branch coverage
100%
Covered branches: 8
Total branches: 8
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_SplitOption()100%11100%
get_OnlyInSystem()100%11100%
FromRequest(...)100%22100%
ParseParts()100%66100%

File(s)

/home/runner/work/Studio2Prod/Studio2Prod/AppRepository/LabelServices/OzonOrderSplitConfig.cs

#LineLine coverage
 1namespace Services.LabelServices;
 2
 3/// <summary>
 4/// Конфигурация разделения заказа для пайплайна печати (совпадает с форматом JS <c>{ splitOption, onlyInSystem }</c>).
 5/// </summary>
 6public sealed class OzonOrderSplitConfig
 7{
 128    public required string SplitOption { get; init; }
 9
 810    public bool OnlyInSystem { get; init; }
 11
 12    public static OzonOrderSplitConfig FromRequest(string splitOption, bool onlyInSystem = false) =>
 613        new()
 614        {
 615            SplitOption = splitOption ?? string.Empty,
 616            OnlyInSystem = onlyInSystem
 617        };
 18
 19    public (int Part1, int Part2) ParseParts()
 20    {
 421        var tokens = SplitOption.Split(' ', StringSplitOptions.RemoveEmptyEntries);
 22
 423        if (tokens.Length != 2)
 24        {
 125            throw new ArgumentException("Неверный формат параметра разделения");
 26        }
 27
 328        if (!int.TryParse(tokens[0], out var part1) || !int.TryParse(tokens[1], out var part2))
 29        {
 230            throw new ArgumentException("Неверный числовой формат параметра разделения");
 31        }
 32
 133        return (part1, part2);
 34    }
 35}