public void GetConnectionStringReturnsNullForNotFoundString()
        {
            var target = new DefaultWebConfigurationManager();

            var result = target.GetConnectionString("very unknown name");

            Assert.IsNull(result);
        }
        public void GetAppSettingReturnsFoundSetting()
        {
            var target = new DefaultWebConfigurationManager();

            var result = target.GetAppSetting("defaultKey1");

            Assert.AreEqual("defaultValue1", result);
        }
        public void GetConnectionStringReturnsFoundString()
        {
            var target = new DefaultWebConfigurationManager();

            var result = target.GetConnectionString("defaultName1");

            Assert.AreEqual("System.Data.SqlClient", result.ProviderName);
            Assert.AreEqual("defaultString1", result.ConnectionString);
        }
        public void NonGenericGetSectionReturnsNullForNotFoundSection()
        {
            var target = new DefaultWebConfigurationManager();

            var result = target.GetSection("very unknown name");

            Assert.IsNull(result);
        }
        public void NonGenericGetSectionReturnsFoundSection()
        {
            var target = new DefaultWebConfigurationManager();

            var result = target.GetSection("defaultSection1");

            Assert.IsNotNull(result);
            Assert.IsInstanceOf<TestConfigurationSection>(result);
            Assert.AreEqual("defaultTestValue1", ((TestConfigurationSection)result).TestValue);
        }
        public void GenericGetSectionReturnsNullForExistingSectionOfWrongType()
        {
            var target = new DefaultWebConfigurationManager();

            var result = target.GetSection<TestConfigurationSection>("anotherTestConfigurationSection");

            Assert.IsNull(result);
        }