public static TypeParam IsOfType(this TypeParam param, Type type)
        {
            if (!param.Type.Equals(type))
            {
                throw ExceptionFactory.CreateForParamValidation(param,
                                                                ExceptionMessages.EnsureExtensions_IsNotOfType.Inject(param.Type.FullName));
            }

            return(param);
        }
Esempio n. 2
0
        public static void IsNotOfType(this TypeParam param, Type type)
        {
            if (!Ensure.IsActive)
            {
                return;
            }

            if (param.Type == type)
            {
                throw ExceptionFactory.CreateForParamValidation(param, ExceptionMessages.Types_IsNotOfType_Failed.Inject(type.FullName));
            }
        }
Esempio n. 3
0
        public static void IsClass(this TypeParam param)
        {
            if (!Ensure.IsActive)
            {
                return;
            }

            if (!param.Type.GetTypeInfo().IsClass)
            {
                throw ExceptionFactory.CreateForParamValidation(param,
                                                                ExceptionMessages.Types_IsClass_Failed.Inject(param.Type.FullName));
            }
        }
Esempio n. 4
0
 public static TypeParam IsShort(this TypeParam param)
 {
     return(IsOfType(param, Types.ShortType));
 }
Esempio n. 5
0
 public static TypeParam IsInt(this TypeParam param)
 {
     return(IsOfType(param, Types.IntType));
 }
 public static void IsNotOfType(this TypeParam param, Type expectedType)
 => Ensure.Type.IsNotOfType(param.Type, expectedType, param.Name, param.OptsFn);
Esempio n. 7
0
 public static TypeParam IsDateTime(this TypeParam param)
 {
     return(IsOfType(param, Types.DateTimeType));
 }
Esempio n. 8
0
 public static TypeParam IsFloat(this TypeParam param)
 {
     return(IsOfType(param, Types.FloatType));
 }
Esempio n. 9
0
 public static void IsFloat(this TypeParam param) => IsOfType(param, Types.FloatType);
Esempio n. 10
0
 public static void IsDouble(this TypeParam param) => IsOfType(param, Types.DoubleType);
Esempio n. 11
0
 public static void IsDecimal(this TypeParam param) => IsOfType(param, Types.DecimalType);
Esempio n. 12
0
 public static void IsShort(this TypeParam param) => IsOfType(param, Types.ShortType);
Esempio n. 13
0
 public static void IsInt(this TypeParam param) => IsOfType(param, Types.IntType);
 public static void IsInt(this TypeParam param)
 => Ensure.Type.IsInt(param.Type, param.Name, param.OptsFn);
Esempio n. 15
0
 public static TypeParam IsDecimal(this TypeParam param)
 {
     return(IsOfType(param, Types.DecimalType));
 }
Esempio n. 16
0
 public static void IsBool(this TypeParam param) => IsOfType(param, Types.BoolType);
Esempio n. 17
0
 public static TypeParam IsDouble(this TypeParam param)
 {
     return(IsOfType(param, Types.DoubleType));
 }
Esempio n. 18
0
 public static void IsDateTime(this TypeParam param) => IsOfType(param, Types.DateTimeType);
Esempio n. 19
0
 public static TypeParam IsBool(this TypeParam param)
 {
     return(IsOfType(param, Types.BoolType));
 }
Esempio n. 20
0
 public static void IsString(this TypeParam param) => IsOfType(param, Types.StringType);
Esempio n. 21
0
 public static TypeParam IsString(this TypeParam param)
 {
     return(IsOfType(param, Types.StringType));
 }
 public static void IsDateTime(this TypeParam param)
 => Ensure.Type.IsDateTime(param.Type, param.Name, param.OptsFn);