Exemple #1
0
 private void GivenAttributeExpectsNullValueAndDependentValueIsNull()
 {
     _validationAttribute = new RequiredIfNotContains(ModelForRequiredIfContains.DependentPropertyName, null);
     _testContext         = new ValidationContext(new ModelForRequiredIfContains {
         DependentProperty = null
     }, null, null);
 }
Exemple #2
0
 private void GivenDependentPropertyIsNotEnumerable()
 {
     _validationAttribute = new RequiredIfNotContains(ModelForRequiredIfContains.InvalidDependentPropertyName,
                                                      string.Empty);
     _testContext = new ValidationContext(
         new ModelForRequiredIfContains {
         InvalidDependentProperty = 0
     }, null, null);
 }
Exemple #3
0
 private void GivenAttributeExpectsEmptyValueAndDependentValueIsEmptyList()
 {
     _validationAttribute = new RequiredIfNotContains(ModelForRequiredIfContains.DependentPropertyName,
                                                      string.Empty);
     _testContext = new ValidationContext(
         new ModelForRequiredIfContains {
         DependentProperty = new List <string>()
     }, null, null);
 }
Exemple #4
0
 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);
 }