private void GivenDependentPropertyIsNotEnumerable() { _validationAttribute = new RequiredIfNotContainsOneOf(ModelForRequiredIfContains.InvalidDependentPropertyName, new object[] {string.Empty}); _testContext = new ValidationContext( new ModelForRequiredIfContains {InvalidDependentProperty = 0}, null, null); }
private void GivenAttributeExpectsNullValueAndDependentValueIsNull() { _validationAttribute = new RequiredIfNotContainsOneOf(ModelForRequiredIfContains.DependentPropertyName, null); _testContext = new ValidationContext(new ModelForRequiredIfContains {DependentProperty = null}, null, null); }
private void GivenAttributeExpectsSomeValueAndDependentValueIsListWithSomeValue() { _validationAttribute = new RequiredIfNotContainsOneOf(ModelForRequiredIfContains.DependentPropertyName, new object[] {"Some Value"}); _testContext = new ValidationContext( new ModelForRequiredIfContains {DependentProperty = new List<string> {"one", "Some Value", "two"}}, null, null); }
private void GivenAttributeExpectsEmptyValueAndDependentValueIsEmptyList() { _validationAttribute = new RequiredIfNotContainsOneOf(ModelForRequiredIfContains.DependentPropertyName, new object[] {string.Empty}); _testContext = new ValidationContext( new ModelForRequiredIfContains {DependentProperty = new List<string>()}, null, null); }