< Summary

Information
Class: ValidateLib.Metadata.Descriptors.FormatDescriptor
Assembly: validatelib.dll
File(s): C:\skola_karlovka\RP\code\csv-validator\CSV_Validator\ValidateLib\Metadata\Descriptors\FormatDescriptor.cs
Line coverage
69%
Covered lines: 9
Uncovered lines: 4
Coverable lines: 13
Total lines: 42
Line coverage: 69.2%
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
GetParser(...)20
getTypeForTypeProperty()01
GetPropertyParser(...)138

File(s)

C:\skola_karlovka\RP\code\csv-validator\CSV_Validator\ValidateLib\Metadata\Descriptors\FormatDescriptor.cs

#LineLine coverage
 1using Newtonsoft.Json.Linq;
 2using ValidateLib.ErrorsAndWarnings.Warnings;
 3using ValidateLib.Metadata.Descriptors.Interfaces;
 4using ValidateLib.Metadata.Parsers;
 5using ValidateLib.Metadata.PropertyParsers;
 6using ValidateLib.Metadata.PropertyParsers.DataType.Format;
 7using ValidateLib.Metadata.PropertyParsers.DescriptorNS;
 8
 9namespace ValidateLib.Metadata.Descriptors
 10{
 11    public class FormatDescriptor : Descriptor, Interfaces.IParsable<FormatDescriptor>, ITypable
 12    {
 113        public string? decimalChar { get; set; }
 114        public string? groupChar { get; set; }
 115        public string? pattern { get; set; }
 116        public bool wasObject { get; set; } = false;
 17        public static IParser<FormatDescriptor> GetParser(List<Warning> warnings, FormatDescriptor? descriptor = null)
 18        {
 119            return new FormatParser(warnings);
 20        }
 21
 022        public new static string getTypeForTypeProperty() => "Datatype";
 23
 24        public new IPropertyParserBase? GetPropertyParser(JProperty property, List<Warning> warnings)
 25        {
 126            switch (property.Name)
 27            {
 28                case "decimalChar":
 129                    return new DecimalCharPropertyParser(warnings, this);
 30                case "groupChar":
 131                    return new GroupCharPropertyParser(warnings, this);
 32                case "pattern":
 133                    return new PatternPropertyParser(warnings, this);
 34                case "@type":
 035                    return new TypePropertyParser<FormatDescriptor>(warnings, this);
 36                default:
 037                    warnings.Add(WarningFactory.GetUnknownPropertyWarning(property));
 038                    return null;
 39            }
 40        }
 41    }
 42}