< Summary

Information
Class: ValidateLib.Metadata.Properties.AtomicProperties.AtomicPropertyArray<T>
Assembly: validatelib.dll
File(s): C:\skola_karlovka\RP\code\csv-validator\CSV_Validator\ValidateLib\Metadata\Properties\AtomicProperties\AtomicPropertyArray.cs
Line coverage
4%
Covered lines: 1
Uncovered lines: 20
Coverable lines: 21
Total lines: 60
Line coverage: 4.7%
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
AtomicPropertyArray(...)20
Normalize(...)079

File(s)

C:\skola_karlovka\RP\code\csv-validator\CSV_Validator\ValidateLib\Metadata\Properties\AtomicProperties\AtomicPropertyArray.cs

#LineLine coverage
 1using Newtonsoft.Json.Linq;
 2using ValidateLib.ErrorsAndWarnings.Warnings;
 3using ValidateLib.Metadata.Descriptors;
 4using ValidateLib.Metadata.Descriptors.Interfaces;
 5
 6namespace ValidateLib.Metadata.Properties.AtomicProperties
 7{
 8    public class AtomicPropertyArray<T> : AtomicProperty<List<T>>, INormalize
 9    {
 110        public AtomicPropertyArray(List<T> value) : base(value) { }
 11
 12        public static List<Warning> Normalize(JToken token, Context context, JProperty? property = null)
 13        {
 014            List<Warning> warnings = new List<Warning>();
 015            if (token.Type != JTokenType.Array) return warnings;
 016            else if (typeof(T) == typeof(string))
 17            {
 018                foreach (var item in token)
 19                {
 020                    if (item.Type != JTokenType.String) return warnings;
 21                }
 022                return warnings;
 23            }
 024            else if (typeof(T) == typeof(bool))
 25            {
 26
 027                foreach (var item in token)
 28                {
 029                    if (item.Type != JTokenType.Boolean) return warnings;
 30                }
 031                return warnings;
 32            }
 033            else if (typeof(T) == typeof(int))
 34            {
 35
 036                foreach (var item in token)
 37                {
 038                    if (item.Type != JTokenType.Integer) return warnings;
 39                }
 040                return warnings;
 41            }
 042            else if (typeof(T) == typeof(double))
 43            {
 44
 045                foreach (var item in token)
 46                {
 047                    if (item.Type != JTokenType.Float) return warnings;
 48                }
 049                return warnings;
 50            }
 51            else
 52            {
 053                throw new NotImplementedException();
 54            }
 055        }
 56
 57
 58
 59    }
 60}