protected override void Act()
        {
            base.Act();

            var cloner = new ConfigurationSectionCloner();
            clonedSection = (UnityConfigurationSection)cloner.Clone(Section);
        }
 protected override void Arrange()
 {
     cloner = new ConfigurationSectionCloner();
     section = new TestConfigurationSection();
     section.Custom.Name = "custom";
     section.Custom.Attributes.Add("k1", "v1");
     section.Custom.Attributes.Add("k2", "v2");
 }
        protected void ProtectSection(FileConfigurationSource source, string sectionName, string protectionProvider)
        {
            ConfigurationSectionCloner cloner = new ConfigurationSectionCloner();
            var section = source.GetSection(sectionName);
            section = cloner.Clone(section);

            source.Remove(sectionName);
            source.Add(sectionName, section, protectionProvider);
        }
        protected override void Arrange()
        {
            base.Arrange();

            var configurationFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "unity.config");
            var source = new FileConfigurationSource(configurationFilePath);
            sectionToClone = (UnityConfigurationSection)source.GetSection("unity");

            //editableSection = (UnityConfigurationSection)base.UnitySectionViewModel.ConfigurationElement;
            //editableSection.TypeAliases.Add(new AliasElement("alias1", typeof(int))); 
            //editableSection.TypeAliases.Add(new AliasElement("alias2", typeof(string)));

            //editableSection.Containers.Add(new ContainerElement()
            //{
            //    Name = "cloned",
            //    Registrations = {{
            //    new RegisterElement
            //    {
            //        Name = "Registration1",
            //        TypeName = "RegistrationTypeName",
            //        InjectionMembers = {{
            //                            new PropertyElement 
            //                            {
            //                                Name = "Property1",
            //                                Value = new ValueElement
            //                                {
            //                                    Value = "PropertyValue"
            //                                }
            //                            }
            //                         },
            //                         {
            //                             new ConstructorElement 
            //                             {
            //                                 Parameters = 
            //                                 {{
            //                                      new ParameterElement
            //                                      {
            //                                          Name = "array",
            //                                          Value = new ArrayElement
            //                                          {
            //                                              TypeName = "t",
            //                                              Values = {{new ArrayElement()},{new ValueElement
            //                                                                             {
            //                                                                                 Value = "v"
            //                                                                             }}}
            //                                          }
            //                                      }
            //                                 }}
            //                             }
            //                         }}
            //    }}}
            //});


            cloner = new ConfigurationSectionCloner();
        }
        /// <summary>
        /// Save the configuration source.
        /// </summary>
        /// <param name="configurationSource">The IDesignConfigurationSource.</param>
        public override void Save(Common.Configuration.Design.IDesignConfigurationSource configurationSource)
        {
            var typeRegistrationSection = configurationSource.GetLocalSection(TypeRegistrationProvidersConfigurationSection.SectionName) as TypeRegistrationProvidersConfigurationSection;

            if (typeRegistrationSection == null)
            {
                typeRegistrationSection = new TypeRegistrationProvidersConfigurationSection();
                typeRegistrationSection.TypeRegistrationProviders.Clear();
                AddAutoscalingTypeRegistrationProviderElement(configurationSource, typeRegistrationSection);
            }
            else
            {
                if (!typeRegistrationSection.TypeRegistrationProviders.Contains(RetryPolicyConfigurationSettings.SectionName))
                {
                    var cloner = new ConfigurationSectionCloner();
                    var savableSection = cloner.Clone(typeRegistrationSection) as TypeRegistrationProvidersConfigurationSection;
                    AddAutoscalingTypeRegistrationProviderElement(configurationSource, savableSection);
                }
            }

            base.Save(configurationSource);
        }
        private static ConfigurationSection CloneSection(ConfigurationSection sourceSection)
        {
            var cloner = new ConfigurationSectionCloner();

            return(cloner.Clone(sourceSection));
        }
 private static ConfigurationSection CloneSection(ConfigurationSection sourceSection)
 {
     var cloner = new ConfigurationSectionCloner();
     return cloner.Clone(sourceSection);
 }