Exemple #1
0
        public static void Validate_successful_for_empty_string_if_AllowEmptyStrings_is_true()
        {
            var attribute = new RequiredAttribute();

            attribute.AllowEmptyStrings = true;
            AssertEx.DoesNotThrow(() => attribute.Validate(string.Empty, s_testValidationContext));
        }
Exemple #2
0
        public static void Validation_throws_ValidationException_for_empty_string_if_AllowEmptyStrings_is_false()
        {
            var attribute = new RequiredAttribute();

            attribute.AllowEmptyStrings = false;
            Assert.Throws <ValidationException>(() => attribute.Validate(string.Empty, s_testValidationContext));
        }
 public static void Validate_successful_for_non_string_object()
 {
     var attribute = new RequiredAttribute();
     AssertEx.DoesNotThrow(() => attribute.Validate(new object(), s_testValidationContext));
 }
 public static void Validate_successful_for_empty_string_if_AllowEmptyStrings_is_true()
 {
     var attribute = new RequiredAttribute();
     attribute.AllowEmptyStrings = true;
     AssertEx.DoesNotThrow(() => attribute.Validate(string.Empty, s_testValidationContext));
 }
 public static void Validate_successful_for_non_empty_string_if_AllowEmptyStrings_is_false()
 {
     var attribute = new RequiredAttribute();
     AssertEx.DoesNotThrow(() => attribute.Validate("SomeString", s_testValidationContext));
 }
 public static void Validation_throws_ValidationException_for_empty_string_if_AllowEmptyStrings_is_false()
 {
     var attribute = new RequiredAttribute();
     attribute.AllowEmptyStrings = false;
     Assert.Throws<ValidationException>(() => attribute.Validate(string.Empty, s_testValidationContext));
 }
 public static void Validation_throws_ValidationException_for_null_value()
 {
     var attribute = new RequiredAttribute();
     Assert.Throws<ValidationException>(() => attribute.Validate(null, s_testValidationContext));
 }
Exemple #8
0
        public static void Validate_successful_for_non_string_object()
        {
            var attribute = new RequiredAttribute();

            AssertEx.DoesNotThrow(() => attribute.Validate(new object(), s_testValidationContext));
        }
Exemple #9
0
        public static void Validate_successful_for_non_empty_string_if_AllowEmptyStrings_is_false()
        {
            var attribute = new RequiredAttribute();

            AssertEx.DoesNotThrow(() => attribute.Validate("SomeString", s_testValidationContext));
        }
Exemple #10
0
        public static void Validation_throws_ValidationException_for_null_value()
        {
            var attribute = new RequiredAttribute();

            Assert.Throws <ValidationException>(() => attribute.Validate(null, s_testValidationContext));
        }