< Summary

Information
Class: ValidateLib.Metadata.Parsers.AtomicProperties.AtomicPropertyBooleanParser
Assembly: validatelib.dll
File(s): C:\skola_karlovka\RP\code\csv-validator\CSV_Validator\ValidateLib\Metadata\Parsers\AtomicProperties\AtomicPropertyBooleanParser.cs
Line coverage
100%
Covered lines: 10
Uncovered lines: 0
Coverable lines: 10
Total lines: 30
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
AtomicPropertyBooleanParser(...)61
ParseJToken(...)130

File(s)

C:\skola_karlovka\RP\code\csv-validator\CSV_Validator\ValidateLib\Metadata\Parsers\AtomicProperties\AtomicPropertyBooleanParser.cs

#LineLine coverage
 1using Newtonsoft.Json.Linq;
 2using ValidateLib.ErrorsAndWarnings.Warnings;
 3using ValidateLib.Metadata.Properties.AtomicProperties;
 4
 5namespace ValidateLib.Metadata.Parsers.AtomicProperties
 6{
 7    internal class AtomicPropertyBooleanParser : IParser<AtomicPropertyBoolean>
 8    {
 19        public List<Warning> Warnings { get; set; } = new List<Warning>();
 110        public AtomicPropertyBoolean Descriptor { get; set; } = new AtomicPropertyBoolean(false);
 11
 112        public AtomicPropertyBooleanParser(List<Warning> warnings, AtomicPropertyBoolean? defaultValue = null)
 13        {
 114            Warnings = warnings;
 115            if (defaultValue != null) Descriptor = defaultValue;
 116        }
 17
 18
 19        public AtomicPropertyBoolean ParseJToken(JToken jToken, string propertyName)
 20        {
 121            if (jToken.Type != JTokenType.Boolean)
 22            {
 123                Warnings.Add(WarningFactory.GetAtomicPropertyBoolWrongValueWarning(jToken, propertyName, jToken.Type.ToS
 124                return Descriptor;
 25            }
 126            else return new AtomicPropertyBoolean(bool.Parse(jToken.ToString()));
 27        }
 28
 29    }
 30}