예제 #1
0
        public void AdditinalSettings_should_be_overwritten()
        {
            // arrange
            var to       = new ModelMetadataItem();
            var settings = new DummyAdditinalSettings {
                Name = "val"
            };

            to.AdditionalSettings.Add(settings);

            var from      = new ModelMetadataItem();
            var settings2 = new DummyAdditinalSettings {
                Name = "val2"
            };

            from.AdditionalSettings.Add(settings2);

            // act
            from.MergeTo(to);

            // assert
            var item = to.GetAdditionalSetting <DummyAdditinalSettings>();

            Assert.NotNull(item);
            Assert.Equal("val", item.Name);
        }
예제 #2
0
        public void AdditinalSettings_should_set_if_it_was_added_for_from_metadata()
        {
            // arrange
            var to = new ModelMetadataItem();

            var from = new ModelMetadataItem();
            var settings = new DummyAdditinalSettings { Name = "val2" };
            from.AdditionalSettings.Add(settings);

            // act
            from.MergeTo(to);

            // assert
            var item = to.GetAdditionalSetting<DummyAdditinalSettings>();
            Assert.NotNull(item);
            Assert.Equal("val2", item.Name);
        }
예제 #3
0
        public void AdditinalSettings_should_not_removed()
        {
            // arrange
            var to = new ModelMetadataItem();
            var settings = new DummyAdditinalSettings { Name = "val" };
            to.AdditionalSettings.Add(settings);

            var from = new ModelMetadataItem();

            // act
            from.MergeTo(to);

            // assert
            var item = to.GetAdditionalSetting<DummyAdditinalSettings>();
            Assert.NotNull(item);
            Assert.Equal("val", item.Name);
        }
예제 #4
0
        public void AdditinalSettings_should_set_if_it_was_added_for_from_metadata()
        {
            // arrange
            var to = new ModelMetadataItem();

            var from     = new ModelMetadataItem();
            var settings = new DummyAdditinalSettings {
                Name = "val2"
            };

            from.AdditionalSettings.Add(settings);

            // act
            from.MergeTo(to);

            // assert
            var item = to.GetAdditionalSetting <DummyAdditinalSettings>();

            Assert.NotNull(item);
            Assert.Equal("val2", item.Name);
        }