< Summary

Information
Class: Services.ApiServices.FavoritPartsApi.FavoritPartsProfile
Assembly: Services
File(s): /home/runner/work/Studio2Prod/Studio2Prod/AppRepository/ApiServices/FavoritPartsApi/FavoritPartsProfile.cs
Line coverage
71%
Covered lines: 5
Uncovered lines: 2
Coverable lines: 7
Total lines: 20
Line coverage: 71.4%
Branch coverage
50%
Covered branches: 4
Total branches: 8
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
ResolveDefaultDeliveryDestination(...)50%9871.42%

File(s)

/home/runner/work/Studio2Prod/Studio2Prod/AppRepository/ApiServices/FavoritPartsApi/FavoritPartsProfile.cs

#LineLine coverage
 1using Newtonsoft.Json.Linq;
 2
 3namespace Services.ApiServices.FavoritPartsApi;
 4
 5public static class FavoritPartsProfile
 6{
 7    /// <summary>Возвращает точку доставки по умолчанию из профиля покупателя.</summary>
 8    public static string? ResolveDefaultDeliveryDestination(JToken profile)
 9    {
 110        if (profile is not JObject root)
 011            return null;
 12
 113        var defaultId = root.Value<string>("tradePointDef");
 114        if (string.IsNullOrWhiteSpace(defaultId) || root["tradePoints"] is not JObject points || points[defaultId] is no
 015            return null;
 16
 117        return string.Join(", ", new[] { point.Value<string>("name"), point.Value<string>("address") }
 518            .Where(value => !string.IsNullOrWhiteSpace(value)).Select(value => value!.Trim()).Distinct());
 19    }
 20}