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