예제 #1
0
        public void ShouldResolvePropertySetByBaseResolver()
        {
            var destType    = typeof(ClassW4Properties);
            var testBuilder = new TestTypeBuilder <ClassW2Properties, ClassW4Properties>();

            testBuilder.PropertyToResolve = destType.GetProperty("Prop3");
            testBuilder.ProertyValue      = 3;

            var mapper = new TestTypeMapper <ClassW2Properties, ClassW4Properties>(() => testBuilder);
            var source = new ClassW2Properties();
            var dest   = mapper.Map(source);

            Assert.IsNotNull(dest);
            Assert.AreEqual(3, dest.Prop3);
        }
예제 #2
0
        public void ShouldUserPriorBuilder()
        {
            var destType    = typeof(ClassW4Properties);
            var testBuilder = new TestTypeBuilder <ClassW2Properties, ClassW4Properties>();

            testBuilder.PropertyToResolve = destType.GetProperty("Prop2");
            testBuilder.ProertyValue      = 3;

            var mapper = new TestTypeMapper <ClassW2Properties, ClassW4Properties>(() => testBuilder);
            var source = new ClassW2Properties {
                Prop2 = 2
            };
            var dest = mapper.Map(source);

            Assert.IsNotNull(dest);
            Assert.AreEqual(2, dest.Prop2);
        }