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