< Summary

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

File(s)

C:\skola_karlovka\RP\code\csv-validator\CSV_Validator\ValidateLib\Metadata\PropertyParsers\InheritedProperties\LangPropertyParser.cs

#LineLine coverage
 1using Newtonsoft.Json.Linq;
 2using ValidateLib.ErrorsAndWarnings.Warnings;
 3using ValidateLib.Metadata.Descriptors;
 4using ValidateLib.Metadata.Properties.AtomicProperties;
 5using ValidateLib.UtilityClasses;
 6
 7namespace ValidateLib.Metadata.PropertyParsers.InheritedProperties
 8{
 9    internal class LangPropertyParser : PropertyParserBase<InheritedPropertiesDescriptor>, IPropertyParser<InheritedProp
 10    {
 111        public LangPropertyParser(List<Warning> warnings, InheritedPropertiesDescriptor descriptor) : base(warnings, des
 12        {
 113        }
 14
 15        public void ParseProperty(JProperty property)
 16        {
 117            if (property.Value.Type != JTokenType.String)
 18            {
 019                Warnings.Add(WarningFactory.GetStringPropertyWrongValueWarning(property.Value, property.Name, property.V
 020                Descriptor.lang = new AtomicPropertyString("und");
 21            }
 22            else
 23            {
 124                if (!LanguageUtilityClass.IsCorrectLanguageCode(property.Value.ToString()))
 25                {
 126                    Warnings.Add(WarningFactory.GetLangWrongValueWarning(property.ToString()));
 127                    Descriptor.lang = new AtomicPropertyString("und");
 28                }
 29                else
 30                {
 131                    Descriptor.lang = new AtomicPropertyString(property.Value.ToString());
 32                }
 33            }
 134        }
 35    }
 36}