Exemplo n.º 1
0
        private void UpdateConfig()
        {
            bool changes             = false;
            var  websiteConfigUpdate = new SiteWithConfig(website, currentSiteConfig);

            if (SiteWithConfig != null)
            {
                websiteConfigUpdate = SiteWithConfig;
                changes             = true;
            }

            changes = changes || ObjectDeltaMapper.Map(this, currentSiteConfig, websiteConfigUpdate, "HostNames", "SiteWithConfig", "PassThru");

            if (changes)
            {
                WebsitesClient.UpdateWebsiteConfiguration(Name, websiteConfigUpdate.GetSiteConfig(), Slot);
            }
        }
Exemplo n.º 2
0
        public void NullSourcePropertyIsNotAChange()
        {
            var src = new SourceClass
            {
                A = null,
                C = "hello"
            };

            var reference = new RefClass
            {
                A = 4,
                C = "hello"
            };

            var  dest    = new DestClass();
            bool changes = ObjectDeltaMapper.Map(src, reference, dest);

            Assert.False(changes);
        }
Exemplo n.º 3
0
        public void MappingWithNoChangesReturnsFalse()
        {
            var src = new SourceClass
            {
                A        = 1,
                B        = true,
                C        = "hello",
                Excluded = 42.0
            };

            var reference = new RefClass
            {
                A = 1,
                C = "hello"
            };

            var dest = new DestClass();

            bool changes = ObjectDeltaMapper.Map(src, reference, dest, "Excluded");

            Assert.False(changes);
        }
Exemplo n.º 4
0
        public void MappingWithChangeCopiesChangedProperties()
        {
            var src = new SourceClass
            {
                A        = 1,
                B        = true,
                C        = "hello",
                Excluded = 42.0
            };

            var reference = new RefClass
            {
                A = 4,
                C = "hello"
            };

            var dest = new DestClass();

            bool changes = ObjectDeltaMapper.Map(src, reference, dest, "Excluded");

            Assert.True(changes);
            Assert.Equal(1, dest.A);
            Assert.Null(dest.C);
        }