/// <summary>
        /// Adds to the <paramref name="container"/> the policy definitions represented in the configuration file.
        /// </summary>
        /// <param name="container">The container on which the injection policies must be configured.</param>
        /// <param name="configurationSource">The configuration source from which additional information
        /// can be retrieved, if necessary.</param>
        public void ConfigureContainer(IUnityContainer container, IConfigurationSource configurationSource)
        {
            Guard.ArgumentNotNull(container, "container");
            Guard.ArgumentNotNull(configurationSource, "configurationSource");

            UnityContainerConfigurator configurator = new UnityContainerConfigurator(container);
            configurator.RegisterAll(configurationSource, this);
        }
        public void Given()
        {
            configurationSource = new MockConfigSource();

            var mock = new Mock<ITypeRegistrationsProvider>();
            mock.Setup(p => p.GetRegistrations(It.IsAny<IConfigurationSource>()))
                .Returns(new TypeRegistration[0]);

            mockRegistrationsProvider = mock.Object;

            container = new UnityContainer();
            configurator = new UnityContainerConfigurator(container);
            configurator.RegisterAll(configurationSource, mockRegistrationsProvider);
        }
        public void Given()
        {
            container = new UnityContainer();
            var configurationSource = new DictionaryConfigurationSource();
            ValidationSettings settings = new ValidationSettings();
            configurationSource.Add(ValidationSettings.SectionName, settings);
            ValidatedTypeReference typeReference = new ValidatedTypeReference(typeof(BaseTestDomainObject));
            settings.Types.Add(typeReference);
            typeReference.DefaultRuleset = "RuleA";
            ValidationRulesetData ruleData = new ValidationRulesetData("RuleA");
            typeReference.Rulesets.Add(ruleData);
            ValidatedPropertyReference propertyReference1 = new ValidatedPropertyReference("Property1");
            ruleData.Properties.Add(propertyReference1);
            MockValidatorData validator11 = new MockValidatorData("validator1", true);
            propertyReference1.Validators.Add(validator11);
            validator11.MessageTemplate = "message-from-config1-RuleA";
            MockValidatorData validator12 = new MockValidatorData("validator2", true);
            propertyReference1.Validators.Add(validator12);
            validator12.MessageTemplate = "message-from-config2-RuleA";
            MockValidatorData validator13 = new MockValidatorData("validator3", false);
            propertyReference1.Validators.Add(validator13);
            validator13.MessageTemplate = "message-from-config3-RuleA";

            var typeRegistrationProvider = new ValidationTypeRegistrationProvider();
            var configurator = new UnityContainerConfigurator(container);
            configurator.RegisterAll(configurationSource, typeRegistrationProvider);
        }
 public void Given()
 {
     container = new UnityContainer();
     var typeRegistrationProvider = new ValidationTypeRegistrationProvider();
     var configurator = new UnityContainerConfigurator(container);
     configurator.RegisterAll(
         new DictionaryConfigurationSource(),
         typeRegistrationProvider);
 }