Exemplo n.º 1
0
        public void Naming_convention_example_with_preconfiguration()
        {
            var ugly = new UglyThirdPartyClass
                {
                    Prop_IntId = 123,
                    Prop_StrName = "name"
                };

            var mapper = new ObjectMapper();

            mapper.ConfigureMap<UglyThirdPartyClass, NiceClass>(x => x.Convention(propertyInfo => propertyInfo.Name.Substring(8)));
            
            var nice = mapper.Map<NiceClass>(ugly);

            Assert.AreEqual(123, nice.Id);
            Assert.AreEqual("name", nice.Name);
        }