Beispiel #1
0
        public void TestCreateProperty_NonExistentProperty()
        {
            var configuration = new MockConfiguration_Storage1_SectionAttributeForDefaultSection_Section1(source);

            var property = configuration.CreatePropertyPublic("missing property name", "default");

            Assert.Fail();
        }
Beispiel #2
0
        public void TestCreateProperty_ExistingProperty()
        {
            var configuration = new MockConfiguration_Storage1_SectionAttributeForDefaultSection_Section1(source);

            var property = configuration.CreatePropertyPublic(nameof(configuration.StringSetting), "default");

            configuration.StringSettingProperty = property;

            string actualValue = configuration.StringSetting;
            object expectedValue;
            bool   read = configuration.Storage1.Storage.TryRead(configuration.Section1, property.Key, property.ValueType, out expectedValue);

            Assert.IsTrue(read);
            Assert.AreEqual(expectedValue, actualValue);
        }