< Summary

Information
Class: ValidateLib.Metadata.PropertyParsers.TopLevelObject.TableDirectionPropertyParser
Assembly: validatelib.dll
File(s): C:\skola_karlovka\RP\code\csv-validator\CSV_Validator\ValidateLib\Metadata\PropertyParsers\TopLevelObject\TableDirectionPropertyParser.cs
Line coverage
63%
Covered lines: 7
Uncovered lines: 4
Coverable lines: 11
Total lines: 33
Line coverage: 63.6%
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
TableDirectionPropertyParser(...)20
ParseProperty(...)1315

File(s)

C:\skola_karlovka\RP\code\csv-validator\CSV_Validator\ValidateLib\Metadata\PropertyParsers\TopLevelObject\TableDirectionPropertyParser.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.TopLevelObject
 7{
 8    public class TableDirectionPropertyParser : PropertyParserBase<TopLevelObjectDescriptor>, IPropertyParser<TopLevelOb
 9    {
 110        public TableDirectionPropertyParser(List<Warning> warnings, TopLevelObjectDescriptor descriptor) : base(warnings
 11        {
 112        }
 13
 14        public void ParseProperty(JProperty property)
 15        {
 116            string[] allowedValues = { "rtl", "ltr", "auto" };
 117            if (property.Value.Type != JTokenType.String)
 18            {
 019                Warnings.Add(WarningFactory.GetTableDirectionWrongValueWarning(property.Value.ToString()));
 020                Descriptor.tableDirection = new AtomicPropertyString("auto");
 21            }
 22            else
 23            {
 124                bool stringInAllowedValues = Array.Exists(allowedValues, element => element == property.Value.ToString()
 125                if (!stringInAllowedValues)
 26                {
 127                    Warnings.Add(WarningFactory.GetTableDirectionWrongValueWarning(property.Value.ToString()));
 28                }
 029                else Descriptor.tableDirection = new AtomicPropertyString(property.Value.ToString());
 30            }
 031        }
 32    }
 33}