private static object GenerateRandomValue(PropertyInfo propertyInfo)
{
object val = null;
Type t = propertyInfo.PropertyType;
if (t.IsNullable()) t = Nullable.GetUnderlyingType(t);
if (t == typeof(string))
{
val = GenerateString(propertyInfo);
}
else if (t == typeof(int) || t == typeof(uint) || t == typeof(ushort) || t == typeof(short) || t == typeof(long) || t == typeof(ulong))
{
val = GenerateNumeric(propertyInfo);
}
else if (t == typeof(bool)) val = true;
else if (t == typeof(DateTime)) val = DateTime.Now.Date;
else if (typeof(ISmartReference).IsAssignableFrom(t))
{
val = GenerateSmartReference(propertyInfo);
}
if (val != null && propertyInfo.PropertyType.IsNullable())
{
val = new NullableConverter(propertyInfo.PropertyType).ConvertFrom(val);
}
return val;
}