Exemple #1
0
 public void CanTestPrimitiveDataType(DataType type, bool expected)
 {
     Assert.AreEqual(type.IsPrimitive(), expected);
 }
Exemple #2
0
        //NOTE:type dependant
        private static bool ValidateEnumeration(object value, DataType type, Node node, string listStr, bool isBlackList)
        {
            bool result;
            if (!String.IsNullOrWhiteSpace(listStr)
                && value != null
                && type.IsPrimitive())
            {
                var enumSchema = new FieldSchema { DataType = type };
                var list = listStr.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
                                  .Select(x => Parsers.ParseString(x, enumSchema, node.Context))
                                  .Where(x => x != null);
                var inList = list.Cast<dynamic>()
                                 .Any(x => x.Equals(value));
                result = isBlackList
                            ? !inList
                            : inList;
            }
            else
            {
                result = true;
            }

            return result;
        }
Exemple #3
0
 private static DataType AcceptDataType(DataType value)
 {
     return (value.IsPrimitive() ? value : default(DataType));
 }