Пример #1
0
        public static void Validate_IConvertibleThrowsCustomException_IsNotCaught()
        {
            CustomValidationAttribute attribute = GetAttribute(nameof(CustomValidator.CorrectValidationMethodOneArgInt));

            Assert.Throws <ArithmeticException>(() => attribute.Validate(new IConvertibleImplementor()
            {
                IntThrow = new ArithmeticException()
            }, s_testValidationContext));
        }
Пример #2
0
        public static void Validate_MethodThrowsCustomException_IsNotCaught()
        {
            CustomValidationAttribute attribute = GetAttribute(nameof(CustomValidator.ValidationMethodThrowsException));

            AssertExtensions.Throws <ArgumentException>(null, () => attribute.Validate(new IConvertibleImplementor(), s_testValidationContext));
        }
Пример #3
0
        public static void Validate_BadlyFormed_ThrowsInvalidOperationException(Type validatorType, string method)
        {
            CustomValidationAttribute attribute = new CustomValidationAttribute(validatorType, method);

            Assert.Throws <InvalidOperationException>(() => attribute.Validate("Does not matter", s_testValidationContext));
        }
 public static void Validate_BadlyFormed_ThrowsInvalidOperationException(Type validatorType, string method)
 {
     CustomValidationAttribute attribute = new CustomValidationAttribute(validatorType, method);
     Assert.Throws<InvalidOperationException>(() => attribute.Validate("Does not matter", s_testValidationContext));
 }