Example #1
0
        public void SetPropertiesList()
        {
            TestConfigurationClass configuration = new TestConfigurationClass {
                Name = "name", Sex = MySexEnum.Female
            };
            List <MyConfigurationProperty> configurationProperties = MyConfigManager.GetConfigurationProperties(configuration);

            Assert.That(configurationProperties.Count, Is.EqualTo(4));

            foreach (MyConfigurationProperty property in configurationProperties)
            {
                Console.WriteLine("Property: {0}={1} ({2})", property.Name, property.Value, property.Type);
            }

            Console.WriteLine("Updated configuration");
            configurationProperties[0].Value = "new value";
            configurationProperties[3].Value = "new title";
            TestConfigurationClass updatedConfiguration = MyConfigManager.CreateConfiguration <TestConfigurationClass>(configurationProperties);

            Assert.That(updatedConfiguration.Name, Is.EqualTo("new value"));
            Assert.That(updatedConfiguration.SubClass.Title, Is.EqualTo("new title"));
            List <MyConfigurationProperty> updatedConfigurationProperties = MyConfigManager.GetConfigurationProperties(updatedConfiguration);

            foreach (MyConfigurationProperty property in updatedConfigurationProperties)
            {
                Console.WriteLine("Property: {0}={1} ({2})", property.Name, property.Value, property.Type);
            }
        }
Example #2
0
        public void TestAppConfig()
        {
            TestConfigurationClass configuration = new TestConfigurationClass {
                Name = "name", Sex = MySexEnum.Female
            };

            ConfigManager.SaveConfiguration <TestConfigurationClass>(configuration, m_configurationFileName);
            TestConfigurationClass loadedConfig = ConfigManager.LoadConfiguration <TestConfigurationClass>(m_configurationFileName);

            Assert.That(loadedConfig.Name, Is.EqualTo("name"));
            Assert.Pass();
        }
Example #3
0
        public void GetPropertiesList()
        {
            TestConfigurationClass configuration = new TestConfigurationClass {
                Name = "name", Sex = MySexEnum.Female
            };
            List <MyConfigurationProperty> configurationProperties = MyConfigManager.GetConfigurationProperties(configuration);

            foreach (MyConfigurationProperty property in configurationProperties)
            {
                Console.WriteLine("Property: {0}={1} ({2})", property.Name, property.Value, property.Type);
            }

            Assert.That(configurationProperties.Count, Is.EqualTo(4));
        }