< Summary

Information
Class: ValidateLib.Metadata.PropertyParsers.DIalect.SkipRowsPropertyParser
Assembly: validatelib.dll
File(s): C:\skola_karlovka\RP\code\csv-validator\CSV_Validator\ValidateLib\Metadata\PropertyParsers\DIalect\SkipRowsPropertyParser.cs
Line coverage
80%
Covered lines: 8
Uncovered lines: 2
Coverable lines: 10
Total lines: 34
Line coverage: 80%
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
SkipRowsPropertyParser(...)20
ParseProperty(...)2012

File(s)

C:\skola_karlovka\RP\code\csv-validator\CSV_Validator\ValidateLib\Metadata\PropertyParsers\DIalect\SkipRowsPropertyParser.cs

#LineLine coverage
 1using Newtonsoft.Json.Linq;
 2using ValidateLib.ErrorsAndWarnings.Warnings;
 3using ValidateLib.Metadata.Descriptors;
 4using ValidateLib.Metadata.Properties.AtomicProperties;
 5
 6namespace ValidateLib.Metadata.PropertyParsers.DIalect
 7{
 8    internal class SkipRowsPropertyParser : PropertyParserBase<DialectDescriptor>, IPropertyParser<DialectDescriptor>
 9    {
 110        public SkipRowsPropertyParser(List<Warning> warnings, DialectDescriptor descriptor) : base(warnings, descriptor)
 11        {
 112        }
 13
 14        public void ParseProperty(JProperty property)
 15        {
 116            if (property.Value.Type != JTokenType.Integer)
 17            {
 018                Warnings.Add(WarningFactory.GetAtomicIntegerWrongValueWarning(property.Value, property.Name, property.Va
 019                Descriptor.skipRows = new AtomicPropertyInteger(0);
 20            }
 21            else
 22            {
 123                if ((int)property.Value >= 0)
 124                    Descriptor.skipRows = new AtomicPropertyInteger((int)property.Value);
 25                else
 26                {
 127                    Warnings.Add(WarningFactory.GetNegativeSkipRowsWarning(property.ToString()));
 128                    Descriptor.skipRows = new AtomicPropertyInteger(0);
 29                }
 30
 31            }
 132        }
 33    }
 34}