GetSection() public method

Returns a LogSetting based on the LogConfiguration supplied in the constructor.
public GetSection ( string sectionName ) : object
sectionName string This parameter is not used in this implementation.
return object
        public void GetSection_NullFactoryAdapter_ThrowsConfigurationException()
        {
            var config = new LogConfiguration();

            var reader = new LogConfigurationReader(config);

            Assert.Throws <ConfigurationException>(() => reader.GetSection(null));
        }
        public void GetSection_NullFactoryAdapter_ThrowsConfigurationException()
        {
            var config = new LogConfiguration();

            var reader = new LogConfigurationReader(config);

            Assert.Throws<ConfigurationException>(() => reader.GetSection(null));
        }
        public void GetSection_BadFactoryAdapterType_ThrowsConfigurationException()
        {
            var config = new LogConfiguration()
            {
                FactoryAdapter = new FactoryAdapterConfiguration()
                {
                    Type = "SomeType, SomeAssembly"
                }
            };

            var reader = new LogConfigurationReader(config);

            Assert.Throws <ConfigurationException>(() => reader.GetSection(null));
        }
        public void GetSection_EmptyFactoryAdapterType_ThrowsConfigurationException()
        {
            var config = new LogConfiguration()
            {
                FactoryAdapter = new FactoryAdapterConfiguration()
                {
                    Type = ""
                }
            };

            var reader = new LogConfigurationReader(config);

            Assert.Throws<ConfigurationException>(() => reader.GetSection(null));
        }
        public void GetSection_GoodFactoryAdapterType_ReturnsLogSettingWithType()
        {
            var config = new LogConfiguration()
            {
                FactoryAdapter = new FactoryAdapterConfiguration()
                {
                    Type = typeof(FakeFactoryAdapter).AssemblyQualifiedName
                }
            };

            var reader = new LogConfigurationReader(config);

            var result = reader.GetSection(null) as LogSetting;

            Assert.NotNull(result);
            Assert.AreEqual(typeof(FakeFactoryAdapter), result.FactoryAdapterType);
        }
        public void GetSection_NoArguments_ReturnsLogSettingWithNullArguments()
        {
            var config = new LogConfiguration()
            {
                FactoryAdapter = new FactoryAdapterConfiguration()
                {
                    Type = typeof(FakeFactoryAdapter).AssemblyQualifiedName
                }
            };

            var reader = new LogConfigurationReader(config);

            var result = reader.GetSection(null) as LogSetting;

            Assert.NotNull(result);
            Assert.IsNull(result.Properties);
        }
        public void GetSection_HasArguments_ReturnsLogSettingWithArguments()
        {
            var config = new LogConfiguration()
            {
                FactoryAdapter = new FactoryAdapterConfiguration()
                {
                    Type      = typeof(FakeFactoryAdapter).AssemblyQualifiedName,
                    Arguments = new NameValueCollection
                    {
                        { "arg1", "value1" }
                    }
                }
            };

            var reader = new LogConfigurationReader(config);

            var result = reader.GetSection(null) as LogSetting;

            Assert.NotNull(result);
            Assert.AreEqual("value1", result.Properties["arg1"]);
        }
        public void GetSection_GoodFactoryAdapterType_ReturnsLogSettingWithType()
        {
            var config = new LogConfiguration()
            {
                FactoryAdapter = new FactoryAdapterConfiguration()
                {
                    Type = typeof(FakeFactoryAdapter).AssemblyQualifiedName
                }
            };

            var reader = new LogConfigurationReader(config);

            var result = reader.GetSection(null) as LogSetting;

            Assert.NotNull(result);
            Assert.AreEqual(typeof(FakeFactoryAdapter), result.FactoryAdapterType);
        }
        public void GetSection_HasArguments_ReturnsLogSettingWithArguments()
        {
            var config = new LogConfiguration()
            {
                FactoryAdapter = new FactoryAdapterConfiguration()
                {
                    Type = typeof(FakeFactoryAdapter).AssemblyQualifiedName,
                    Arguments = new NameValueCollection
                    {
                        { "arg1", "value1" }
                    }
                }
            };

            var reader = new LogConfigurationReader(config);

            var result = reader.GetSection(null) as LogSetting;

            Assert.NotNull(result);
            Assert.AreEqual("value1", result.Properties["arg1"]);
        }
        public void GetSection_NoArguments_ReturnsLogSettingWithNullArguments()
        {
            var config = new LogConfiguration()
            {
                FactoryAdapter = new FactoryAdapterConfiguration()
                {
                    Type = typeof(FakeFactoryAdapter).AssemblyQualifiedName
                }
            };

            var reader = new LogConfigurationReader(config);

            var result = reader.GetSection(null) as LogSetting;

            Assert.NotNull(result);
            Assert.IsNull(result.Properties);
        }