public void RetunsExpectedValuesForIValidationIntegrationProxyImplementation()
        {
            ValidationProvider validationProvider = new ValidationProvider();

            validationProvider.RulesetName         = "ruleset";
            validationProvider.SourceTypeName      = typeof(ValidatedControlItemFixtureTestClass).AssemblyQualifiedName;
            validationProvider.SpecificationSource = ValidationSpecificationSource.Configuration;
            MockControl control = new MockControl();

            control.Text = "value";
            control.IntControlProperty = 5;
            ValidatedControlItem validatedControlItem
                = new ValidatedControlItem(validationProvider, control);

            validatedControlItem.ValidatedPropertyName = "Text";
            validatedControlItem.SourcePropertyName    = "IntProperty";

            IValidationIntegrationProxy proxy = validatedControlItem;

            Assert.AreSame(typeof(ValidatedControlItemFixtureTestClass), proxy.ValidatedType);
            Assert.AreEqual("IntProperty", proxy.ValidatedPropertyName);
            Assert.AreEqual(ValidationSpecificationSource.Configuration, proxy.SpecificationSource);
            Assert.AreEqual("ruleset", proxy.Ruleset);
            Assert.AreSame(typeof(PropertyMappedControlValueAccessBuilder), proxy.GetMemberValueAccessBuilder().GetType());
        }
Exemplo n.º 2
0
 /// <summary>
 /// Returns the <see cref="Validator"/> represented by the configuration in the <see cref="IValidationIntegrationProxy"/>, linked
 /// with the integration scenario as necessary.
 /// </summary>
 public Validator GetValidator()
 {
     return(PropertyValidationFactory.GetPropertyValidator(validatedType,
                                                           validatedProperty,
                                                           integrationProxy.Ruleset,
                                                           integrationProxy.SpecificationSource,
                                                           integrationProxy.GetMemberValueAccessBuilder()));
 }