Exemple #1
0
        public void Can_create_config_from_source_object()
        {
            var source = new MyObjectConfig
            {
                StringProperty = "aaa",
                BoolProperty   = true,
                IntegerArray   = new[] { 1, 2, 3, 4 }
            };

            var config = ConfigurationFactory.FromObject(source);

            Assert.Equal("aaa", config.GetString("StringProperty"));
            Assert.Equal(true, config.GetBoolean("BoolProperty"));

            Assert.Equal(new[] { 1, 2, 3, 4 }, config.GetIntList("IntegerArray").ToArray());
        }
        public void CanCreateConfigFromSourceObject()
        {
            var source = new MyObjectConfig
            {
                StringProperty = "aaa",
                BoolProperty = true,
                IntergerArray = new[]{1,2,3,4 }
            };

            var config = ConfigurationFactory.FromObject(source);

            Assert.AreEqual("aaa", config.GetString("StringProperty"));
            Assert.AreEqual(true, config.GetBoolean("BoolProperty"));

            Assert.AreEqual(new[] { 1, 2, 3, 4 }, config.GetIntList("IntergerArray").ToArray());
        }