Example #1
0
        public void Populate_From_Properties_With_Attribute()
        {
            var originalToObj = ModelWithOnlyStringFields.Create("id-1");
            var toObj         = ModelWithOnlyStringFields.Create("id-1");
            var fromObj       = ModelWithOnlyStringFields.Create("id-2");

            AutoMappingUtils.PopulateFromPropertiesWithAttribute(toObj, fromObj,
                                                                 typeof(IndexAttribute));

            Assert.That(toObj.Id, Is.EqualTo(originalToObj.Id));
            Assert.That(toObj.AlbumId, Is.EqualTo(originalToObj.AlbumId));

            //Properties with IndexAttribute
            Assert.That(toObj.Name, Is.EqualTo(fromObj.Name));
            Assert.That(toObj.AlbumName, Is.EqualTo(fromObj.AlbumName));
        }