< Summary

Information
Class: ValidateLib.Metadata.PropertyParsers.TopLevelObject.TableSchemaPropertyParser
Assembly: validatelib.dll
File(s): C:\skola_karlovka\RP\code\csv-validator\CSV_Validator\ValidateLib\Metadata\PropertyParsers\TopLevelObject\TableSchemaPropertyParser.cs
Line coverage
100%
Covered lines: 10
Uncovered lines: 0
Coverable lines: 10
Total lines: 31
Line coverage: 100%
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
TableSchemaPropertyParser(...)20
ParseProperty(...)200

File(s)

C:\skola_karlovka\RP\code\csv-validator\CSV_Validator\ValidateLib\Metadata\PropertyParsers\TopLevelObject\TableSchemaPropertyParser.cs

#LineLine coverage
 1using Newtonsoft.Json.Linq;
 2using ValidateLib.ErrorsAndWarnings.Warnings;
 3using ValidateLib.Metadata.Descriptors;
 4using ValidateLib.Metadata.Parsers;
 5using ValidateLib.Metadata.Properties;
 6using ValidateLib.Metadata.Validators;
 7
 8namespace ValidateLib.Metadata.PropertyParsers.TopLevelObject
 9{
 10    public class TableSchemaPropertyParser : PropertyParserBase<TopLevelObjectDescriptor>, IPropertyParser<TopLevelObjec
 11    {
 112        public TableSchemaPropertyParser(List<Warning> warnings, TopLevelObjectDescriptor descriptor) : base(warnings, d
 13        {
 114        }
 15
 16        public void ParseProperty(JProperty property)
 17        {
 118            var tableSchemaParser = new SchemaParser(Warnings);
 119            var tableSchemaDescriptor = tableSchemaParser.ParseJToken(property.Value, property.Name);
 120            var primaryKeyValidator = new PrimaryKeyValidator();
 121            Warnings.AddRange(primaryKeyValidator.Validate(tableSchemaDescriptor));
 122            if (!tableSchemaDescriptor.IsInvalid)
 123                Descriptor.tableSchema = new ObjectProperty<SchemaDescriptor>(tableSchemaDescriptor);
 24            else
 25            {
 126                Descriptor.tableSchema = new ObjectProperty<SchemaDescriptor>(new SchemaDescriptor());
 27            }
 28
 129        }
 30    }
 31}