/// <summary>
 /// Convenient method to check if a parameter type is one of the supported type.
 /// </summary>
 /// <remarks>
 /// This convenient method checks if a parameter type is one of the supported type.
 /// </remarks>
 /// <param name="parameter">
 /// The parameter to check its type.
 /// </param>
 /// <param name="property">
 /// The property information that contain additional type information.
 /// </param>
 /// <returns>
 /// True, if type is supported and false otherwise.
 /// </returns>
 public static Boolean IsSupportedDataType(this ParameterObjectAttribute parameter, PropertyInfo property)
 {
     if (parameter is SwitchParameterAttribute)
     {
         return(property.PropertyType == typeof(Boolean) || property.PropertyType == typeof(Boolean?));
     }
     else if (parameter is OptionParameterAttribute)
     {
         return(OptionTypeConverter.IsSupportedType(property.PropertyType));
     }
     else if (parameter is VerbalParameterAttribute)
     {
         return(property.PropertyType == typeof(List <String>) || property.PropertyType == typeof(String[]));
     }
     else
     {
         return(false);
     }
 }
示例#2
0
 public void TryConvert_CheckUnsupportedType_ResultIsEqual(Type type)
 {
     Assert.IsFalse(OptionTypeConverter.IsSupportedType(type));
 }