< Summary

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

Metrics

MethodLine coverage Branch coverage
.ctor()0%100%
.ctor(...)0%0%
get_Id()0%100%
get_Section()0%100%
get_Key()0%100%
get_Encrypted()0%100%
get_ValueType()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    {
 015        public ConfigurationResponseDTO() { }
 016        public ConfigurationResponseDTO(Configuration data)
 017        {
 018            Id = data.Id;
 019            Section = data.Section;
 020            Key = data.Key;
 021            Encrypted = data.Encrypted;
 022            ValueType = new ConfigurationValueTypeDTO(data.ValueType);
 023            Value = data.Encrypted ? SymmetricCrypto.DecryptData(Convert.FromBase64String(data.Value)) : data.Value;
 024            Description = data.Description;
 025        }
 26
 027        public long Id { get; set; }
 028        public string Section { get; set; }
 029        public string Key { get; set; }
 030        public bool Encrypted { get; set; }
 031        public ConfigurationValueTypeDTO ValueType { get; set; }
 032        public string Value { get; set; }
 033        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    {
 49        public string Section { get; set; }
 50        [Required (ErrorMessage = "Название ключа не может быть пустым")]
 51        public string Key { get; set; }
 52        public bool Encrypted { get; set; }
 53        [DigitValidate (CanBeZero = false, CanBeNegative = true)]
 54        [Display(Name = "Тип значения")]
 55        public long ValueTypeId { get; set; }
 56        [Required(ErrorMessage = "Значение ключа не может быть пустым")]
 57        public string Value { get; set; }
 58        public string Description { get; set; }
 59    }
 60}