< Summary

Information
Class: Services.ApiServices._1CApi.Models.OneCStockLine
Assembly: Services
File(s): /home/runner/work/Studio2Prod/Studio2Prod/AppRepository/ApiServices/1CApi/Models/GetStockByArticleModels.cs
Line coverage
75%
Covered lines: 3
Uncovered lines: 1
Coverable lines: 4
Total lines: 53
Line coverage: 75%
Branch coverage
0%
Covered branches: 0
Total branches: 8
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Warehouse()100%11100%
get_Quantity()100%11100%
get_Cost()100%11100%
get_UnitCost()0%7280%

File(s)

/home/runner/work/Studio2Prod/Studio2Prod/AppRepository/ApiServices/1CApi/Models/GetStockByArticleModels.cs

#LineLine coverage
 1using Newtonsoft.Json;
 2
 3namespace Services.ApiServices._1CApi.Models;
 4
 5public class GetStockByArticleResponse
 6{
 7    [JsonProperty("success")]
 8    public bool Success { get; set; }
 9
 10    [JsonProperty("error")]
 11    public string? Error { get; set; }
 12
 13    [JsonProperty("items")]
 14    public List<GetStockByArticleItem>? Items { get; set; } = new();
 15}
 16
 17public class GetStockByArticleItem
 18{
 19    [JsonProperty("Article")]
 20    public string? Article { get; set; }
 21
 22    [JsonProperty("Name")]
 23    public string? Name { get; set; }
 24
 25    [JsonProperty("Success")]
 26    public bool Success { get; set; }
 27
 28    [JsonProperty("Message")]
 29    public string? Message { get; set; }
 30
 31    [JsonProperty("TotalQuantity")]
 32    public decimal? TotalQuantity { get; set; }
 33
 34    [JsonProperty("Stocks")]
 35    public List<OneCStockLine>? Stocks { get; set; } = new();
 36}
 37
 38public class OneCStockLine
 39{
 40    [JsonProperty("Warehouse")]
 3341    public string? Warehouse { get; set; }
 42
 43    [JsonProperty("Quantity")]
 2944    public decimal Quantity { get; set; }
 45
 46    /// <summary>Учётная стоимость остатка (ресурс регистра). Null, если регистр количественный.</summary>
 47    [JsonProperty("Cost")]
 148    public decimal? Cost { get; set; }
 49
 50    /// <summary>Учётная цена за единицу: стоимость, делённая на количество.</summary>
 51    [JsonIgnore]
 052    public decimal? UnitCost => Cost is > 0 && Quantity > 0 ? Cost / Quantity : null;
 53}