< Summary

Information
Class: ValidateLib.Metadata.PropertyParsers.DataType.FormatPropertyParser
Assembly: validatelib.dll
File(s): C:\skola_karlovka\RP\code\csv-validator\CSV_Validator\ValidateLib\Metadata\PropertyParsers\DataType\FormatPropertyParser.cs
Line coverage
92%
Covered lines: 13
Uncovered lines: 1
Coverable lines: 14
Total lines: 35
Line coverage: 92.8%
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
FormatPropertyParser(...)20
ParseProperty(...)259

File(s)

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

#LineLine coverage
 1using Newtonsoft.Json.Linq;
 2using ValidateLib.ErrorsAndWarnings.Warnings;
 3using ValidateLib.Metadata.Descriptors;
 4
 5namespace ValidateLib.Metadata.PropertyParsers.DataType
 6{
 7    internal class FormatPropertyParser : PropertyParserBase<DatatypeDescriptor>, IPropertyParser<DatatypeDescriptor>
 8    {
 19        public FormatPropertyParser(List<Warning> warnings, DatatypeDescriptor descriptor) : base(warnings, descriptor)
 10        {
 111        }
 12
 13        public void ParseProperty(JProperty property)
 14        {
 115            Descriptor.IsBuiltIn = false;
 116            bool wasObject = true;
 117            if (property.Value.Type == JTokenType.String)
 18            {
 119                property.Value.Replace(new JObject(new JProperty("pattern", property.Value.ToString())));
 120                wasObject = false;
 21            }
 22
 123            if (property.Value.Type != JTokenType.Object)
 024                Warnings.Add(WarningFactory.GetFormatPropertyWrongValueWarning(property.Value.ToString(), property.Value
 25            else
 26            {
 127                var formatParser = FormatDescriptor.GetParser(Warnings);
 128                var formatValue = formatParser.ParseJToken(property.Value, property.Name);
 129                Descriptor.format = formatValue;
 130                Descriptor.format.wasObject = wasObject;
 31            }
 32
 133        }
 34    }
 35}