<commit_before>﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml;
using Autofac.Configuration;
using NUnit.Framework;

namespace Autofac.Tests.Configuration
{
    [TestFixture]
    public class ContainerBuilderExtensionsFixture
    {
        [Test(Description = "Attempts to register configuration with a null container builder.")]
        public void RegisterConfigurationSection_NullBuilder()
        {
            ContainerBuilder builder = null;
            var section = CreateSection();
            Assert.Throws<ArgumentNullException>(() => builder.RegisterConfigurationSection(section));
        }

        [Test(Description = "Attempts to register configuration with a null configuration section.")]
        public void RegisterConfigurationSection_NullSection()
        {
            var builder = new ContainerBuilder();
            Assert.Throws<ArgumentNullException>(() => builder.RegisterConfigurationSection(null));
        }

        private static AutofacConfigurationSection CreateSection()
        {
            const string metadataConfiguration =
@"<autofac defaultAssembly=""mscorlib"">
  <components>
    <component type=""System.Object"" service=""System.Object"" name=""a"">
      <metadata>
        <item name=""answer"" value=""42"" type=""System.Int32"" />
      </metadata>
    </component>
  </components>
</autofac>";
            return CreateSection(metadataConfiguration);
        }

        private static AutofacConfigurationSection CreateSection(string config)
        {
            using (var reader = new XmlTextReader(new StringReader(config)))
            {
                return AutofacConfigurationSection.Deserialize(reader);
            }
        }
    }
}<commit_msg>Moved the section handler back to be called SectionHandler for backwards compatibility.<commit_after>﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml;
using Autofac.Configuration;
using NUnit.Framework;

namespace Autofac.Tests.Configuration
{
    [TestFixture]
    public class ContainerBuilderExtensionsFixture
    {
        [Test(Description = "Attempts to register configuration with a null container builder.")]
        public void RegisterConfigurationSection_NullBuilder()
        {
            ContainerBuilder builder = null;
            var section = CreateSection();
            Assert.Throws<ArgumentNullException>(() => builder.RegisterConfigurationSection(section));
        }

        [Test(Description = "Attempts to register configuration with a null configuration section.")]
        public void RegisterConfigurationSection_NullSection()
        {
            var builder = new ContainerBuilder();
            Assert.Throws<ArgumentNullException>(() => builder.RegisterConfigurationSection(null));
        }

        private static SectionHandler CreateSection()
        {
            const string metadataConfiguration =
@"<autofac defaultAssembly=""mscorlib"">
  <components>
    <component type=""System.Object"" service=""System.Object"" name=""a"">
      <metadata>
        <item name=""answer"" value=""42"" type=""System.Int32"" />
      </metadata>
    </component>
  </components>
</autofac>";
            return CreateSection(metadataConfiguration);
        }

        private static SectionHandler CreateSection(string config)
        {
            using (var reader = new XmlTextReader(new StringReader(config)))
            {
                return SectionHandler.Deserialize(reader);
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.09896271376506868, 'fraction_numerical': 0.00224278104850014, 'mean_word_length': 2.9512735326688815, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7540096', 'n_tokens_mistral': 845, 'n_tokens_neox': 823, 'n_words': 207}