< Summary

Information
Class: ValidateLib.Metadata.PropertyParsers.InheritedProperties.TextDirectionPropertyParser
Assembly: validatelib.dll
File(s): C:\skola_karlovka\RP\code\csv-validator\CSV_Validator\ValidateLib\Metadata\PropertyParsers\InheritedProperties\TextDirectionPropertyParser.cs
Line coverage
90%
Covered lines: 10
Uncovered lines: 1
Coverable lines: 11
Total lines: 33
Line coverage: 90.9%
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
TextDirectionPropertyParser(...)20
ParseProperty(...)226

File(s)

C:\skola_karlovka\RP\code\csv-validator\CSV_Validator\ValidateLib\Metadata\PropertyParsers\InheritedProperties\TextDirectionPropertyParser.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 TextDirectionPropertyParser : PropertyParserBase<InheritedPropertiesDescriptor>, IPropertyParser<Inhe
 9    {
 110        public TextDirectionPropertyParser(List<Warning> warnings, InheritedPropertiesDescriptor descriptor) : base(warn
 11        {
 112        }
 13
 14        public void ParseProperty(JProperty property)
 15        {
 116            string[] allowedValues = { "rtl", "ltr", "auto", "inherit" };
 117            if (property.Value.Type != JTokenType.String)
 18            {
 019                Warnings.Add(WarningFactory.GetTextDirectionWrongValueWarning(property.Value.ToString()));
 20            }
 21            else
 22            {
 123                bool stringInAllowedValues = Array.Exists(allowedValues, element => element == property.Value.ToString()
 124                if (!stringInAllowedValues)
 25                {
 126                    Warnings.Add(WarningFactory.GetTextDirectionWrongValueWarning(property.Value.ToString()));
 127                    Descriptor.textDirection = new AtomicPropertyString("inherit");
 28                }
 129                else Descriptor.textDirection = new AtomicPropertyString(property.Value.ToString());
 30            }
 131        }
 32    }
 33}