< Summary

Class:SVETA.Api.Data.DTO.ConfigurationRequestDTO
Assembly:SVETA.Api
File(s):/opt/dev/sveta_api_build/SVETA.Api/Data/DTO/ConfigurationDTO.cs
Covered lines:0
Uncovered lines:6
Coverable lines:6
Total lines:60
Line coverage:0% (0 of 6)
Covered branches:0
Total branches:0

Metrics

MethodLine coverage Branch coverage
get_Section()0%100%
get_Key()0%100%
get_Encrypted()0%100%
get_ValueTypeId()0%100%
get_Value()0%100%
get_Description()0%100%

File(s)

/opt/dev/sveta_api_build/SVETA.Api/Data/DTO/ConfigurationDTO.cs

#LineLine coverage
 1using SVETA.Api.Helpers;
 2using System;
 3using System.Collections.Generic;
 4using System.Linq;
 5using System.Text;
 6using System.Threading.Tasks;
 7using WinSolutions.Sveta.Server.Data.DataModel.Entities;
 8using System.ComponentModel.DataAnnotations;
 9using SVETA.Api.Validation;
 10
 11namespace SVETA.Api.Data.DTO
 12{
 13    public class ConfigurationResponseDTO
 14    {
 15        public ConfigurationResponseDTO() { }
 16        public ConfigurationResponseDTO(Configuration data)
 17        {
 18            Id = data.Id;
 19            Section = data.Section;
 20            Key = data.Key;
 21            Encrypted = data.Encrypted;
 22            ValueType = new ConfigurationValueTypeDTO(data.ValueType);
 23            Value = data.Encrypted ? SymmetricCrypto.DecryptData(Convert.FromBase64String(data.Value)) : data.Value;
 24            Description = data.Description;
 25        }
 26
 27        public long Id { get; set; }
 28        public string Section { get; set; }
 29        public string Key { get; set; }
 30        public bool Encrypted { get; set; }
 31        public ConfigurationValueTypeDTO ValueType { get; set; }
 32        public string Value { get; set; }
 33        public string Description { get; set; }
 34    }
 35
 36    public class ConfigurationValueTypeDTO
 37    {
 38        public ConfigurationValueTypeDTO() { }
 39        public ConfigurationValueTypeDTO(ConfigurationsDataType data)
 40        {
 41            Id = data.Id;
 42            Name = data.Name;
 43        }
 44        public long Id { get; set; }
 45        public string Name { get; set; }
 46    }
 47    public class ConfigurationRequestDTO
 48    {
 049        public string Section { get; set; }
 50        [Required (ErrorMessage = "Название ключа не может быть пустым")]
 051        public string Key { get; set; }
 052        public bool Encrypted { get; set; }
 53        [DigitValidate (CanBeZero = false, CanBeNegative = true)]
 54        [Display(Name = "Тип значения")]
 055        public long ValueTypeId { get; set; }
 56        [Required(ErrorMessage = "Значение ключа не может быть пустым")]
 057        public string Value { get; set; }
 058        public string Description { get; set; }
 59    }
 60}