< Summary

Information
Class: ValidateLib.Metadata.PropertyParsers.Note.NotesPropertyParser
Assembly: validatelib.dll
File(s): C:\skola_karlovka\RP\code\csv-validator\CSV_Validator\ValidateLib\Metadata\PropertyParsers\Note\NotesPropertyParser.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 13
Coverable lines: 13
Total lines: 37
Line coverage: 0%
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(...)02
ParseProperty(...)036

File(s)

C:\skola_karlovka\RP\code\csv-validator\CSV_Validator\ValidateLib\Metadata\PropertyParsers\Note\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.Note
 7{
 8    internal class NotesPropertyParser : PropertyParserBase<TopLevelObjectDescriptor>, IPropertyParser<TopLevelObjectDes
 9    {
 010        public NotesPropertyParser(List<Warning> warnings, TopLevelObjectDescriptor descriptor) : base(warnings, descrip
 11        {
 012        }
 13        public void ParseProperty(JProperty property)
 14        {
 015            if (property.Value.Type != JTokenType.Array)
 16            {
 017                Warnings.Add(WarningFactory.GetArrayPropertyWrongValueWarning(property, property.Value.Type.ToString()))
 018                Descriptor.notes = new ArrayProperty<NoteDescriptor>(new List<NoteDescriptor>());
 19            }
 20            else
 21            {
 022                List<NoteDescriptor> notesObjects = new List<NoteDescriptor>();
 023                foreach (var noteObject in property.Value)
 24                {
 025                    if (noteObject.Type == JTokenType.Object)
 26                    {
 027                        var noteDescriptor = new NoteDescriptor();
 028                        noteDescriptor.Note = new CommonProperty(null, noteObject);
 029                        notesObjects.Add(noteDescriptor);
 30                    }
 31
 32                }
 033                Descriptor.notes = new ArrayProperty<NoteDescriptor>(notesObjects);
 34            }
 035        }
 36    }
 37}