public void GetUnderlyingType__The_Underlying_Type_Of_A_Property_Can_Be_Obtained() { var properties = new MixedProperties(); var propertyInfo = properties.GetType().GetProperties(); var results = new List<bool> { propertyInfo[0].GetUnderlyingType() == typeof (bool), propertyInfo[1].GetUnderlyingType() == typeof (DateTime), propertyInfo[2].GetUnderlyingType() == typeof (Dog), propertyInfo[3].GetUnderlyingType() == typeof (int), propertyInfo[4].GetUnderlyingType() == typeof (DateTime), propertyInfo[5].GetUnderlyingType() == typeof (string) }; Assert.IsTrue(results.All(r => r)); }
public void IsNullableType__A_Nullable_Property_Can_Be_Detected_As_Nullable() { var properties = new MixedProperties(); var propertyInfo = properties.GetType().GetProperties(); var results = new List<bool> { propertyInfo[0].IsNullableType() == false, propertyInfo[1].IsNullableType() == false, propertyInfo[2].IsNullableType(), propertyInfo[3].IsNullableType() == false, propertyInfo[4].IsNullableType(), propertyInfo[5].IsNullableType() }; Assert.IsTrue(results.All(r => r)); }
public void GetDefaultValue__An_Default_Value_From_A_Property_Can_Be_Obtained() { var properties = new MixedProperties(); var propertyInfo = properties.GetType().GetProperties(); var results = new List<bool> { (bool)propertyInfo[0].GetDefaultValue() == false, (DateTime)propertyInfo[1].GetDefaultValue() == DateTime.MinValue, (Dog)propertyInfo[2].GetDefaultValue() == null, (int)propertyInfo[3].GetDefaultValue() == 0, (DateTime?)propertyInfo[4].GetDefaultValue() == null, (string)propertyInfo[5].GetDefaultValue() == null }; Assert.IsTrue(results.All(r => r)); }