/// <summary> /// Initializes a new instance of the <see cref="ModelInfo"/> class. /// </summary> /// <param name="name">The name of the model property.</param> /// <param name="attribute">The attribute.</param> /// <exception cref="ArgumentException">The <paramref name="name"/> is <c>null</c> or whitespace.</exception> /// <exception cref="ArgumentNullException">The <paramref name="attribute"/> is <c>null</c>.</exception> public ModelInfo(string name, ModelAttribute attribute) { Argument.IsNotNullOrWhitespace("name", name); Argument.IsNotNull("attribute", attribute); Name = name; SupportIEditableObject = attribute.SupportIEditableObject; }
public void CorrectlySetsDefaultValues() { var modelAttribute = new ModelAttribute(); Assert.AreEqual(true, modelAttribute.SupportIEditableObject); }
/// <summary> /// Initializes a new instance of the <see cref="ModelInfo"/> class. /// </summary> /// <param name="propertyInfo">The property info of the model property.</param> /// <param name="attribute">The attribute.</param> /// <exception cref="ArgumentNullException">The <paramref name="propertyInfo"/> is <c>null</c>.</exception> /// <exception cref="ArgumentNullException">The <paramref name="attribute"/> is <c>null</c>.</exception> public ModelInfo(PropertyInfo propertyInfo, ModelAttribute attribute) : this(propertyInfo?.Name, propertyInfo?.PropertyType, attribute) { }