public void NoAttributes() { Assert.That(_propertyWithoutAttributeReflector.GetAddingPropertyValidators().Any(), Is.False); Assert.That(_propertyWithoutAttributeReflector.GetHardConstraintPropertyValidators().Any(), Is.False); Assert.That(_propertyWithoutAttributeReflector.GetRemovingPropertyRegistrations().Any(), Is.False); Assert.That(_propertyWithoutAttributeReflector.GetMetaValidationRules().Any(), Is.False); }
public void GettAddingPropertyValidators_BinaryProperty() { var result = _binaryPropertyReflector.GetAddingPropertyValidators().ToArray(); Assert.That(result.Count(), Is.EqualTo(1)); Assert.That(result[0], Is.TypeOf(typeof(NotEmptyValidator))); }
public void GettAddingPropertyValidators_NullableStringPropertyAttribute() { var result = _propertyWithNullableStringPropertyAttributeReflector.GetAddingPropertyValidators().ToArray(); Assert.That(result.Count(), Is.EqualTo(1)); Assert.That(result[0], Is.TypeOf(typeof(LengthValidator))); Assert.That(((LengthValidator)result[0]).Max, Is.EqualTo(10)); }
public void GettAddingPropertyValidators_MandatoryStringPropertyAttribute() { var result = _propertyWithMandatoryStringPropertyAttributeReflector.GetAddingPropertyValidators().ToArray(); Assert.That(result.Count(), Is.EqualTo(2)); Assert.That(result[0], Is.TypeOf(typeof(LengthValidator))); Assert.That(((LengthValidator)result[0]).Max, Is.EqualTo(20)); Assert.That(result[1], Is.TypeOf(typeof(NotEmptyValidator))); }
public void GettAddingPropertyValidators_CollectionProperty() { var result = _collectionPropertyReflector.GetHardConstraintPropertyValidators().ToArray(); Assert.That(result.Count(), Is.EqualTo(2)); Assert.That(result[0], Is.TypeOf(typeof(NotNullValidator))); Assert.That(result[1], Is.TypeOf(typeof(NotEmptyValidator))); Assert.That(_collectionPropertyReflector.GetAddingPropertyValidators().ToArray(), Is.Empty); }