public void TestCollectionsIsNotManditoryAndSectionsWillLoadWithoutThem()
        {
            CustomConfigurations.ConfigurationSectionLoader configurationLoader = (CustomConfigurations.ConfigurationSectionLoader)System.Configuration.ConfigurationManager.GetSection("myCustomGroup/mysection");
            Assert.IsNotNull(configurationLoader);

            ConfigurationGroupElement configGroup = configurationLoader.ConfigGroups["client1"];

            Assert.IsNotNull(configGroup);

            CollectionsGroupCollection collections = configGroup.InnerCollections;

            Assert.IsNotNull(collections);

            ConfigurationGroupElement collectionsGroup1 = collections["col1"];

            Assert.IsNotNull(collectionsGroup1);

            ConfigurationGroupElement collectionsGroup2 = collections["col2"];

            Assert.IsNotNull(collectionsGroup2);


            configurationLoader = (CustomConfigurations.ConfigurationSectionLoader)System.Configuration.ConfigurationManager.GetSection("testsection2");
            Assert.IsNotNull(configurationLoader);

            configGroup = configurationLoader.ConfigGroups["clienta"];
            Assert.IsNotNull(configGroup);

            collections = configGroup.InnerCollections;
            Assert.IsNotNull(collections);
            Assert.AreEqual(0, collections.Count);
        }
 public void Init()
 {
     ConfigurationLoader = (CustomConfigurations.ConfigurationSectionLoader)System.Configuration.ConfigurationManager.GetSection("myCustomGroup/mysection");
     Assert.IsNotNull(ConfigurationLoader);
     ConfigGroup = ConfigurationLoader.ConfigGroups["client1"];
     Assert.IsNotNull(ConfigGroup);
 }
 public void Init()
 {
     ConfigurationLoader = (CustomConfigurations.ConfigurationSectionLoader)System.Configuration.ConfigurationManager.GetSection("myCustomGroup/mysection");
     Assert.IsNotNull(ConfigurationLoader);
     ConfigGroup = ConfigurationLoader.ConfigGroups["client1"];
     Assert.IsNotNull(ConfigGroup);
 }
        public void Init()
        {
            var currentDirectory = Directory.GetCurrentDirectory();
            var exePath = Path.Combine(currentDirectory, "CustomConfigurations.Test.DLL");
            var path = Path.Combine(currentDirectory, "CustomConfigurations.Test.DLL.Config");
            var tempPath = path + "-temp";

            if (!File.Exists(tempPath))
            {
                File.Copy(path, tempPath);
            }
            else
            {
                File.Delete(path);
                File.Move(tempPath, path);
            }

            Configuration config = ConfigurationManager.OpenExeConfiguration(exePath);
            ConfigurationLoader = (CustomConfigurations.ConfigurationSectionLoader)config.GetSection("myCustomGroup/mysection");
            Assert.IsNotNull(ConfigurationLoader);
        }
Exemple #5
0
        public void Init()
        {
            var currentDirectory = Directory.GetCurrentDirectory();
            var exePath          = Path.Combine(currentDirectory, "CustomConfigurations.Test.DLL");
            var path             = Path.Combine(currentDirectory, "CustomConfigurations.Test.DLL.Config");
            var tempPath         = path + "-temp";

            if (!File.Exists(tempPath))
            {
                File.Copy(path, tempPath);
            }
            else
            {
                File.Delete(path);
                File.Move(tempPath, path);
            }

            Configuration config = ConfigurationManager.OpenExeConfiguration(exePath);

            ConfigurationLoader = (CustomConfigurations.ConfigurationSectionLoader)config.GetSection("myCustomGroup/mysection");
            Assert.IsNotNull(ConfigurationLoader);
        }