< Summary

Information
Class: ValidateLib.Metadata.PropertyParsers.TopLevelObject.NotesPropertyParser
Assembly: validatelib.dll
File(s): C:\skola_karlovka\RP\code\csv-validator\CSV_Validator\ValidateLib\Metadata\PropertyParsers\TopLevelObject\NotesPropertyParser.cs
Line coverage
84%
Covered lines: 11
Uncovered lines: 2
Coverable lines: 13
Total lines: 38
Line coverage: 84.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
NotesPropertyParser(...)20
ParseProperty(...)2511

File(s)

C:\skola_karlovka\RP\code\csv-validator\CSV_Validator\ValidateLib\Metadata\PropertyParsers\TopLevelObject\NotesPropertyParser.cs

#LineLine coverage
 1using Newtonsoft.Json.Linq;
 2using ValidateLib.ErrorsAndWarnings.Warnings;
 3using ValidateLib.Metadata.Descriptors;
 4using ValidateLib.Metadata.Properties;
 5
 6namespace ValidateLib.Metadata.PropertyParsers.TopLevelObject
 7{
 8    public class NotesPropertyParser : PropertyParserBase<TopLevelObjectDescriptor>, IPropertyParser<TopLevelObjectDescr
 9    {
 110        public NotesPropertyParser(List<Warning> warnings, TopLevelObjectDescriptor descriptor) : base(warnings, descrip
 11        {
 112        }
 13
 14        public void ParseProperty(JProperty property)
 15        {
 116            if (property.Value.Type != JTokenType.Array)
 17            {
 018                Warnings.Add(WarningFactory.GetArrayPropertyWrongValueWarning(property, property.Value.Type.ToString()))
 019                Descriptor.notes = new ArrayProperty<NoteDescriptor>(new List<NoteDescriptor>());
 20            }
 21            else
 22            {
 123                List<NoteDescriptor> notesObjects = new List<NoteDescriptor>();
 124                foreach (var noteObject in property.Value)
 25                {
 126                    if (noteObject.Type == JTokenType.Object)
 27                    {
 128                        var noteDescriptor = new NoteDescriptor();
 129                        noteDescriptor.Note = new CommonProperty(null, noteObject);
 130                        notesObjects.Add(noteDescriptor);
 31                    }
 32
 33                }
 134                Descriptor.notes = new ArrayProperty<NoteDescriptor>(notesObjects);
 35            }
 136        }
 37    }
 38}