< Summary

Information
Class: ValidateLib.Metadata.PropertyParsers.Schema.RowTitlesPropertyParser
Assembly: validatelib.dll
File(s): C:\skola_karlovka\RP\code\csv-validator\CSV_Validator\ValidateLib\Metadata\PropertyParsers\Schema\RowTitlesPropertyParser.cs
Line coverage
75%
Covered lines: 15
Uncovered lines: 5
Coverable lines: 20
Total lines: 50
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
RowTitlesPropertyParser(...)20
ParseProperty(...)4227

File(s)

C:\skola_karlovka\RP\code\csv-validator\CSV_Validator\ValidateLib\Metadata\PropertyParsers\Schema\RowTitlesPropertyParser.cs

#LineLine coverage
 1using Newtonsoft.Json.Linq;
 2using ValidateLib.ErrorsAndWarnings.Warnings;
 3using ValidateLib.Metadata.Descriptors;
 4using ValidateLib.Metadata.Properties;
 5using ValidateLib.Metadata.Validators;
 6
 7namespace ValidateLib.Metadata.PropertyParsers.Schema
 8{
 9    internal class RowTitlesPropertyParser : PropertyParserBase<SchemaDescriptor>, IPropertyParser<SchemaDescriptor>
 10    {
 111        public RowTitlesPropertyParser(List<Warning> warnings, SchemaDescriptor descriptor) : base(warnings, descriptor)
 12        {
 113        }
 14        public void ParseProperty(JProperty property)
 15        {
 116            if (property.Value.Type == JTokenType.String)
 17            {
 118                var rowTitlesValidator = new RowTitlesValidator();
 119                rowTitlesValidator.Validate(Descriptor);
 120                Descriptor.rowTitles = new ColumnReferenceProperty(new List<string>() { property.Value.ToString() });
 21            }
 122            else if (property.Value.Type == JTokenType.Array)
 23            {
 124                List<string> rowTitles = new List<string>();
 125                foreach (var referencedColumnName in property.Value)
 26                {
 127                    if (referencedColumnName.Type != JTokenType.String)
 28                    {
 029                        Warnings.Add(WarningFactory.GetColumnReferencePropertyWrongValueWarning(property.Value, property
 030                        return;
 31                    }
 32                    else
 133                        rowTitles.Add(referencedColumnName.ToString());
 34
 35                }
 136                if (rowTitles.Count > 0)
 37                {
 138                    var rowTitlesValidator = new RowTitlesValidator();
 139                    rowTitlesValidator.Validate(Descriptor);
 140                    Descriptor.rowTitles = new ColumnReferenceProperty(rowTitles);
 41                }
 42
 43                else
 044                    Warnings.Add(WarningFactory.GetColumnReferencePropertyWrongValueWarning(property.Value, property.Nam
 45            }
 46            else
 047                Warnings.Add(WarningFactory.GetColumnReferencePropertyWrongValueWarning(property.Value, property.Name, p
 048        }
 49    }
 50}