Inheritance: ConfigurationValidatorAttribute
コード例 #1
0
        public void MethodNameIsExpected()
        {
            var testCallBackValidatorAttribute = new CallbackValidatorAttribute
            {
                CallbackMethodName = "12345"
            };

            Assert.Equal("12345", testCallBackValidatorAttribute.CallbackMethodName);
        }
コード例 #2
0
        public void TypeIsExpected()
        {
            var testCallBackValidatorAttribute = new CallbackValidatorAttribute
            {
                Type = typeof(double)
            };

            Assert.Equal(typeof(double), testCallBackValidatorAttribute.Type);
        }
コード例 #3
0
        public void GetValidatorInstance_CallBackMethodNullThrows()
        {
            var testCallBackValidatorAttribute = new CallbackValidatorAttribute
            {
                Type = typeof(double)
            };

            Assert.Throws <ArgumentException>(() => testCallBackValidatorAttribute.ValidatorInstance);
        }
コード例 #4
0
        public void GetValidatorInstance_MethodHasTooManyParameters()
        {
            var testCallBackValidatorAttribute = new CallbackValidatorAttribute
            {
                Type = typeof(CallBackValidatorAttributeTests),
                CallbackMethodName = "CallBackValidatorTestMethodNumberTwo"
            };

            Assert.Throws <ArgumentException>(() => testCallBackValidatorAttribute.ValidatorInstance);
        }
コード例 #5
0
        public void SuccessfulCallback_CallTwice()
        {
            var testCallBackValidatorAttribute = new CallbackValidatorAttribute
            {
                Type = typeof(CallBackValidatorAttributeTests),
                CallbackMethodName = "CallBackValidatorTestMethod"
            };
            var response = testCallBackValidatorAttribute.ValidatorInstance;

            Assert.IsType <CallbackValidator>(testCallBackValidatorAttribute.ValidatorInstance);
        }
コード例 #6
0
        public void GetValidatorInstance_DefaultConstructorThrows()
        {
            var testCallBackValidatorAttribute = new CallbackValidatorAttribute();

            Assert.Throws <ArgumentNullException>(() => testCallBackValidatorAttribute.ValidatorInstance);
        }