コード例 #1
0
        public void Can_add_and_find_attribute()
        {
            var settingItem = new SettingItemGroup(SettingName);
            var attr        = new SettingAttributeItem("Attr1", "AttributeValue1");

            settingItem.Add(attr);

            var foundAttr = settingItem.GetAttribute("Attr1");

            Assert.NotNull(foundAttr);
            Assert.Equal("AttributeValue1", foundAttr.Value);
        }
コード例 #2
0
        public void Can_overwrite_attribute_value_of_existing_child()
        {
            var settingItem = new SettingItemGroup(SettingName);
            var attr        = new SettingAttributeItem("Attr1", "AttributeValue1");

            settingItem.Add(attr);

            var overwriteAttr2 = new SettingAttributeItem("Attr1", "OverwriteAttr");

            settingItem.Add(overwriteAttr2);

            var foundAttr = settingItem.GetAttribute("Attr1");

            Assert.Equal <SettingItemBase>(overwriteAttr2, foundAttr);
        }
コード例 #3
0
        public void Setting_name_is_case_insensitive()
        {
            var settingItem = new SettingItemGroup(SettingName);
            var child       = new SettingItemGroup("ChildItem", "ChildItemValue");
            var attr        = new SettingAttributeItem("Attr1", "AttributeValue1");

            settingItem.Add(child);
            settingItem.Add(attr);

            var foundChild = settingItem.GetChild("childitem");
            var foundAttr  = settingItem.GetAttribute("attr1");

            Assert.NotNull(foundChild);
            Assert.NotNull(foundAttr);
        }