< Summary

Class:WinSolutions.Sveta.Server.Data.DataModel.Entities.MovementItem
Assembly:WinSolutions.Sveta.Server
File(s):/opt/dev/sveta_api_build/WinSolutions.Sveta.Server/Data/DataModel/Entities/MovementItem.cs
Covered lines:7
Uncovered lines:4
Coverable lines:11
Total lines:60
Line coverage:63.6% (7 of 11)
Covered branches:0
Total branches:0

Metrics

MethodLine coverage Branch coverage
get_MovementId()0%100%
get_Movement()0%100%
get_GoodId()0%100%
get_Good()100%100%
get_Price()100%100%
get_Quantity()100%100%
get_Comment()100%100%
GetRatioForCalculation(...)0%100%
CalculatePrice(...)100%100%

File(s)

/opt/dev/sveta_api_build/WinSolutions.Sveta.Server/Data/DataModel/Entities/MovementItem.cs

#LineLine coverage
 1using System;
 2using System.ComponentModel.DataAnnotations;
 3using System.ComponentModel.DataAnnotations.Schema;
 4using System.Linq;
 5using WinSolutions.Sveta.Server.Data.DataModel.Extensions;
 6
 7namespace WinSolutions.Sveta.Server.Data.DataModel.Entities
 8{
 9    public class MovementItem : ExternalRecord, ITrackableRecord
 10    {
 011        public long? MovementId { get; set; }
 12
 013        public Movement Movement { get; set; }
 14
 15        /// <summary>
 16        /// Ключ товара
 17        /// </summary>
 018        public long GoodId { get; set; }
 19        /// <summary>
 20        /// Товар
 21        /// </summary>
 22        [Required]
 212623        public Good Good { get; set; }
 24
 25
 26        /// <summary>
 27        /// Цена
 28        /// </summary>
 29        [Required]
 30        [Column(TypeName = "decimal(18,2)")]
 81431        public decimal Price { get; set; }
 32
 33
 34        /// <summary>
 35        /// Количество
 36        /// </summary>
 37        [Required]
 38        [Column(TypeName = "decimal(18,2)")]
 88939        public decimal Quantity { get; set; }
 40
 41        /// <summary>
 42        /// Комментарий к позиции в документе
 43        /// </summary>
 2044        public string Comment { get; set; }
 45
 46        public decimal GetRatioForCalculation(long senderId) =>
 047            this.Good.Category.DepartmentCategoryRatios.ActualRatioForCalculations(senderId);
 48
 49        /// <summary>
 50        /// Расчитывает стоимость позиции
 51        /// </summary>
 52        /// <param name="contractRatio">Кооэффициент контракта для расчетов</param>
 53        /// <param name="clusterRatio">Кооэффициент кластера для расчетов</param>
 54        /// <param name="senderId">Идентификатор отправителя</param>
 55        public void CalculatePrice(Cluster cluster, decimal contractRatio)
 14556        {
 14557            Price = Good.CurrentPrice(cluster, contractRatio);
 14558        }
 59    }
 60}