< Summary

Information
Class: ValidateLib.Metadata.PropertyParsers.DataType.BasePropertyParser
Assembly: validatelib.dll
File(s): C:\skola_karlovka\RP\code\csv-validator\CSV_Validator\ValidateLib\Metadata\PropertyParsers\DataType\BasePropertyParser.cs
Line coverage
75%
Covered lines: 9
Uncovered lines: 3
Coverable lines: 12
Total lines: 37
Line coverage: 75%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBlocks covered Blocks not covered
BasePropertyParser(...)20
ParseProperty(...)2212

File(s)

C:\skola_karlovka\RP\code\csv-validator\CSV_Validator\ValidateLib\Metadata\PropertyParsers\DataType\BasePropertyParser.cs

#LineLine coverage
 1using Newtonsoft.Json.Linq;
 2using ValidateLib.ErrorsAndWarnings.Warnings;
 3using ValidateLib.Metadata.Descriptors;
 4using ValidateLib.UtilityClasses;
 5
 6namespace ValidateLib.Metadata.PropertyParsers.DataType
 7{
 8    internal class BasePropertyParser : PropertyParserBase<DatatypeDescriptor>, IPropertyParser<DatatypeDescriptor>
 9    {
 110        public BasePropertyParser(List<Warning> warnings, DatatypeDescriptor descriptor) : base(warnings, descriptor)
 11        {
 112        }
 13
 14        public void ParseProperty(JProperty property)
 15        {
 116            if (property.Value.Type != JTokenType.String)
 17            {
 018                Warnings.Add(WarningFactory.GetStringPropertyWrongValueWarning(property.Value, property.Name, property.V
 019                Descriptor._base = new Properties.AtomicProperties.AtomicPropertyString("string");
 020                return;
 21            }
 22            else
 23            {
 124                if (!DatatypeUtilityClass.IsBuiltInType(property.Value.ToString()))
 25                {
 126                    Warnings.Add(WarningFactory.GetDatatypeBaseWrongValueWarning(property.Value.ToString()));
 127                    Descriptor._base = new Properties.AtomicProperties.AtomicPropertyString("string");
 128                    return;
 29                }
 30                else
 31                {
 132                    Descriptor._base = new Properties.AtomicProperties.AtomicPropertyString(property.Value.ToString());
 33                }
 34            }
 135        }
 36    }
 37}