< Summary

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

File(s)

C:\skola_karlovka\RP\code\csv-validator\CSV_Validator\ValidateLib\Metadata\PropertyParsers\InheritedProperties\NullPropertyParser.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.InheritedProperties
 7{
 8    internal class NullPropertyParser : PropertyParserBase<InheritedPropertiesDescriptor>, IPropertyParser<InheritedProp
 9    {
 110        public NullPropertyParser(List<Warning> warnings, InheritedPropertiesDescriptor descriptor) : base(warnings, des
 11        {
 112        }
 13
 14        public void ParseProperty(JProperty property)
 15        {
 116            if (property.Value.Type == JTokenType.String)
 17            {
 118                Descriptor._null = new AtomicPropertyArray<string>(new List<string>() { property.Value.ToString() });
 19            }
 120            else if (property.Value.Type == JTokenType.Array)
 21            {
 122                List<string> nullValues = new List<string>();
 123                foreach (var value in property.Value)
 24                {
 125                    if (value.Type == JTokenType.String)
 26                    {
 127                        nullValues.Add(value.ToString());
 28                    }
 29                    else
 30                    {
 131                        Warnings.Add(WarningFactory.GetStringPropertyWrongValueWarning(property.Value, property.Name, pr
 32                    }
 33                }
 134                Descriptor._null = new AtomicPropertyArray<string>(nullValues);
 35            }
 36            else
 37            {
 138                Warnings.Add(WarningFactory.GetNullInvalidValueWarning(property.Value.ToString()));
 139                Descriptor._null = new AtomicPropertyArray<string>(new List<string>() { "" });
 40            }
 141        }
 42    }
 43}