Beispiel #1
0
        public void UnknownItem_Merge_AddshNewChildren()
        {
            var originalSetting = new UnknownItem("Unknown",
                                                  attributes: null,
                                                  children: new List <SettingBase>()
            {
                new AddItem("key", "val")
            });

            var newSetting = new UnknownItem("Unknown",
                                             attributes: null,
                                             children: new List <SettingBase>()
            {
                new SettingText("New test")
            });

            originalSetting.Merge(newSetting);

            var expectedSetting = new UnknownItem("Unknown",
                                                  attributes: null,
                                                  children: new List <SettingBase>()
            {
                new AddItem("key", "val"), new SettingText("New test")
            });

            originalSetting.DeepEquals(expectedSetting).Should().BeTrue();
        }
        public void UnknownItem_Merge_OverridesSimilarAttributes()
        {
            var originalSetting = new UnknownItem("Unknown",
                                                  attributes: new Dictionary <string, string>()
            {
                { "old", "attr" }
            },
                                                  children: null);

            var newSetting = new UnknownItem("Unknown",
                                             attributes: new Dictionary <string, string>()
            {
                { "old", "newAttr" }
            },
                                             children: null);

            originalSetting.Merge(newSetting);

            var expectedSetting = new UnknownItem("Unknown",
                                                  attributes: new Dictionary <string, string>()
            {
                { "old", "newAttr" }
            },
                                                  children: null);

            SettingsTestUtils.DeepEquals(originalSetting, expectedSetting).Should().BeTrue();
        }
Beispiel #3
0
        public void UnknownItem_Merge_AddsNewAttributes()
        {
            var originalSetting = new UnknownItem("Unknown",
                                                  attributes: new Dictionary <string, string>()
            {
                { "old", "attr" }
            },
                                                  children: null);

            var newSetting = new UnknownItem("Unknown",
                                             attributes: new Dictionary <string, string>()
            {
                { "new", "newAttr" }
            },
                                             children: null);

            originalSetting.Merge(newSetting);

            var expectedSetting = new UnknownItem("Unknown",
                                                  attributes: new Dictionary <string, string>()
            {
                { "old", "attr" }, { "new", "newAttr" }
            },
                                                  children: null);

            originalSetting.DeepEquals(expectedSetting).Should().BeTrue();
        }
        public void UnknownItem_Merge_UpdatesSimilarChildren()
        {
            var originalSetting = new UnknownItem("Unknown",
                                                  attributes: null,
                                                  children: new List <SettingBase>()
            {
                new AddItem("key", "val")
            });

            var newSetting = new UnknownItem("Unknown",
                                             attributes: null,
                                             children: new List <SettingBase>()
            {
                new AddItem("key", "val1")
            });

            originalSetting.Merge(newSetting);

            var expectedSetting = new UnknownItem("Unknown",
                                                  attributes: null,
                                                  children: new List <SettingBase>()
            {
                new AddItem("key", "val1")
            });

            SettingsTestUtils.DeepEquals(originalSetting, expectedSetting).Should().BeTrue();
        }