public void ModelWithCollectionRangeAttribute_InvalidModel_ReturnsExpectedResults() { // Arrange var model = new ModelWithCollectionRangeAttribute(); // Act var result = ModelValidator.Validate(model); // Assert AssertIsNotValid(result, nameof(model.EntityIds), typeof(CollectionRangeAttribute), ValidationType.CollectionRange); var attribute = (CollectionRangeAttribute)GetValidationAttribute(result, nameof(model.EntityIds)); Assert.That(attribute.MinLength, Is.EqualTo(1)); Assert.That(attribute.MaxLength, Is.EqualTo(2)); Assert.That(attribute.AllowNull, Is.EqualTo(false)); }
public void ModelWithCollectionRangeAttribute_ValidModel_ReturnsExpectedResults() { // Arrange var model = new ModelWithCollectionRangeAttribute { EntityIds = new List <int> { 1, 2 } }; // Act var result = ModelValidator.Validate(model); // Assert AssertIsValid(result); }