public void CustomExternalValidatorAttribute_Ctor()
        {
            Type   configType     = typeof(FakeComponent);
            string targetProperty = "Value";
            CustomExternalPropertyValidatorAttribute attrib = new CustomExternalPropertyValidatorAttribute(configType, targetProperty, typeof(TestConfigurationValidator));

            Assert.Same(typeof(TestConfigurationValidator), attrib.ValidatorType);
            Assert.IsType <TestConfigurationValidator>(attrib.Validator);
            Assert.Same(configType, attrib.TargetComponentType);
            Assert.Equal(targetProperty, attrib.TargetPropertyName);
        }
        public void CustomExternalPropertyValidatorAttribute_ParameterlessCtor()
        {
            CustomExternalPropertyValidatorAttribute attrib =
                new CustomExternalPropertyValidatorAttribute(typeof(CustomComponent), nameof(CustomComponent.MyProperty), typeof(CustomValidator));

            Assert.Equal(nameof(CustomComponent.MyProperty), attrib.TargetPropertyName);
            Assert.Equal(typeof(CustomComponent), attrib.TargetComponentType);
            Assert.Equal(typeof(CustomValidator), attrib.ValidatorType);
            Assert.IsType <CustomValidator>(attrib.Validator);
            Assert.Empty(attrib.ValidatorConstructorArguments);
        }
        public void CustomComponentValidatorAttribute_Ctor_ParameterizedCtor()
        {
            CustomExternalPropertyValidatorAttribute attrib =
                new CustomExternalPropertyValidatorAttribute(typeof(CustomComponent), nameof(CustomComponent.MyProperty), typeof(CustomValidator2), 1);

            Assert.Equal(nameof(CustomComponent.MyProperty), attrib.TargetPropertyName);
            Assert.Equal(typeof(CustomComponent), attrib.TargetComponentType);
            Assert.Equal(typeof(CustomValidator2), attrib.ValidatorType);
            Assert.IsType <CustomValidator2>(attrib.Validator);
            Assert.Equal(new object[] { 1 }, attrib.ValidatorConstructorArguments);
        }
        public void CustomComponentValidatorAttribute_Validator_ExceptionOnValidatorCtor()
        {
            CustomExternalPropertyValidatorAttribute attrib = new CustomExternalPropertyValidatorAttribute(typeof(CustomComponent), nameof(CustomComponent.MyProperty), typeof(CustomValidator3));

            Assert.Throws <FormatException>(() => { object x = attrib.Validator; });
        }