Example #1
0
        /// <summary>
        ///     Adds the mapping action.
        /// </summary>
        /// <param name="sourceMemberName">Name of the source member.</param>
        /// <param name="targetMemberName">The target member member.</param>
        /// <param name="mappingAction">The mapping action.</param>
        public void AddMappingAction(
            string sourceMemberName,
            string targetMemberName,
            MappingAction <TSource, TTarget> mappingAction)
        {
            var info = new DelegateMappingInfo <TSource, TTarget>(sourceMemberName, targetMemberName, mappingAction);

            AddMappingInfo(info);
        }
Example #2
0
 public void AddTest()
 {
     var m1 = new DelegateMappingInfo<TestClassE, TestClassB>("Prop1", "Prop2", (f, t) => { });
     var m2 = new DelegateMappingInfo<TestClassE, TestClassB>("Prop1", "Prop3", (f, t) => { });
     var target = new TypeMappingInfo<TestClassE, TestClassB>();
     target.Add(m1);
     target.Add(m2);
     Assert.IsTrue(target.GetMappings().Contains(m1));
     Assert.IsTrue(target.GetMappings().Contains(m2));
 }
Example #3
0
        public void AddTest()
        {
            var m1     = new DelegateMappingInfo <TestClassE, TestClassB>("Prop1", "Prop2", (f, t) => { });
            var m2     = new DelegateMappingInfo <TestClassE, TestClassB>("Prop1", "Prop3", (f, t) => { });
            var target = new TypeMappingInfo <TestClassE, TestClassB>();

            target.Add(m1);
            target.Add(m2);
            Assert.IsTrue(target.GetMappings().Contains(m1));
            Assert.IsTrue(target.GetMappings().Contains(m2));
        }
Example #4
0
        public void MapTest()
        {
            bool executed = false;

            var target = new DelegateMappingInfo<TestClassC, TestClassD>(
                "sourceMemberName",
                "targetMemberName",
                (f, t) => executed = true);
            target.Map(new TestClassC(), new TestClassD());

            Assert.IsTrue(executed);
        }
Example #5
0
        public void MapTest()
        {
            bool executed = false;

            var target = new DelegateMappingInfo <TestClassC, TestClassD>(
                "sourceMemberName",
                "targetMemberName",
                (f, t) => executed = true);

            target.Map(new TestClassC(), new TestClassD());

            Assert.IsTrue(executed);
        }