< Summary

Information
Class: ValidateLib.Metadata.PropertyParsers.Transformation.SourcePropertyParser
Assembly: validatelib.dll
File(s): C:\skola_karlovka\RP\code\csv-validator\CSV_Validator\ValidateLib\Metadata\PropertyParsers\Transformation\SourcePropertyParser.cs
Line coverage
53%
Covered lines: 7
Uncovered lines: 6
Coverable lines: 13
Total lines: 39
Line coverage: 53.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
SourcePropertyParser(...)20
ParseProperty(...)1622

File(s)

C:\skola_karlovka\RP\code\csv-validator\CSV_Validator\ValidateLib\Metadata\PropertyParsers\Transformation\SourcePropertyParser.cs

#LineLine coverage
 1using Newtonsoft.Json.Linq;
 2using ValidateLib.ErrorsAndWarnings.Warnings;
 3using ValidateLib.Metadata.Descriptors;
 4
 5namespace ValidateLib.Metadata.PropertyParsers.Transformation
 6{
 7    internal class SourcePropertyParser : PropertyParserBase<TransformationDescriptor>, IPropertyParser<TransformationDe
 8    {
 19        public SourcePropertyParser(List<Warning> warnings, TransformationDescriptor descriptor) : base(warnings, descri
 10        {
 111        }
 12
 13        public void ParseProperty(JProperty property)
 14        {
 115            if (property.Value.Type == JTokenType.Null)
 16            {
 017                Descriptor.source = new Properties.AtomicProperties.AtomicPropertyString(null);
 18            }
 119            else if (property.Value.Type == JTokenType.String)
 20            {
 121                string[] allowedValues = new string[] { "json", "rdf" };
 122                if (allowedValues.Contains(property.Value.ToString()))
 23                {
 124                    Descriptor.source = new Properties.AtomicProperties.AtomicPropertyString(property.Value.ToString());
 25                }
 26                else
 27                {
 028                    Warnings.Add(WarningFactory.GetSourceWrongValueWarning(property.Value.ToString()));
 029                    Descriptor.source = new Properties.AtomicProperties.AtomicPropertyString(null);
 30                }
 31            }
 32            else
 33            {
 034                Warnings.Add(WarningFactory.GetSourceWrongValueWarning(property.Value.ToString()));
 035                Descriptor.source = new Properties.AtomicProperties.AtomicPropertyString(null);
 36            }
 037        }
 38    }
 39}