public void should_set_non_writable_properties()
        {
            var storage = new Mock<IConfigurationStorage>();
            storage.Setup(s => s.GetString("Key1")).Returns("MyValue");
            var configurationBuilder = new ReflectionConfigurationGenerator(storage.Object);

            var config = configurationBuilder.Generate<NonWritablePropertyConfig>();

            Assert.AreEqual("MyValue", config.Value1);
        }
        public void should_populate_string_properties()
        {
            var storage = new Mock<IConfigurationStorage>();
            storage.Setup(s => s.GetString("Key1")).Returns("MyValue");
            var configurationBuilder = new ReflectionConfigurationGenerator(storage.Object);

            var config = configurationBuilder.Generate<StringValueConfig>();

            Assert.AreEqual("MyValue", config.Value1);
        }
        public void should_populate_integer_properties()
        {
            var storage = new Mock<IConfigurationStorage>();
            storage.Setup(s => s.GetInt("Key1")).Returns(555);
            var configurationBuilder = new ReflectionConfigurationGenerator(storage.Object);

            var config = configurationBuilder.Generate<IntegerValueConfig>();

            Assert.AreEqual(555, config.Value1);
        }
        public void should_populate_boolean_properties()
        {
            var storage = new Mock<IConfigurationStorage>();
            storage.Setup(s => s.GetBool("Key1")).Returns(true);
            var configurationBuilder = new ReflectionConfigurationGenerator(storage.Object);

            var config = configurationBuilder.Generate<BooleanValueConfig>();

            Assert.AreEqual(true, config.Value1);
        }
        public void should_fail_if_property_type_is_unsupported()
        {
            var configurationBuilder = new ReflectionConfigurationGenerator(null);

            Assert.Throws<NotSupportedException>(() => configurationBuilder.Generate<UnsupportedValueConfig>());
        }
        public void should_fail_if_key_missing()
        {
            var configurationBuilder = new ReflectionConfigurationGenerator(null);

            Assert.Throws<MissingKeyException>(() => configurationBuilder.Generate<MissingKeyConfig>());
        }