コード例 #1
0
ファイル: ManualMapper.cs プロジェクト: jangocheng/MOO
        /// <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);
        }
コード例 #2
0
ファイル: TypeMappingInfoTest.cs プロジェクト: LuanNunes/MOO
 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));
 }
コード例 #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));
        }
コード例 #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);
        }
コード例 #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);
        }