public void ReverseMap_Success()
        {
            ExpressionMapper.Reset();
            MapperConfigurationTestContainer expected = new MapperConfigurationTestContainer();

            var actual = expected.ReverseMap();

            Assert.IsType <MapperConfiguration <ClassDest, ClassSource> >(actual);
        }
        public void ReverseMap_Success()
        {
            ExpressionMapper.Reset();
            MapperConfigurationTestContainer expected = new MapperConfigurationTestContainer();

            var actual = expected.ReverseMap();

            Assert.IsInstanceOfType(actual, typeof(MapperConfiguration <ClassDest, ClassSource>));
        }
        public void GetDestinationType_WithServiceConstructor()
        {
            ExpressionMapper.ConstructServicesUsing((x) => new ClassDest2());

            var mapper = ExpressionMapper.CreateMap <ClassSource2, IClassDest2>().ConstructUsingServiceLocator();

            ExpressionMapper.Initialize();
            var actual = mapper.GetDestinationType();

            Assert.AreEqual(actual, typeof(ClassDest2));
            ExpressionMapper.Reset();
        }
        public void GetDestinationType_WithServiceConstructor()
        {
            ExpressionMapper.ConstructServicesUsing((x) => new ClassDest2());

            MapperConfiguration <ClassSource2, IClassDest2> mapper = ExpressionMapper.CreateMap <ClassSource2, IClassDest2>().ConstructUsingServiceLocator();

            ExpressionMapper.Initialize();
            Type actual = mapper.GetDestinationType();

            Assert.IsType <ClassDest2>(actual);
            ExpressionMapper.Reset();
        }
        public void CreateCommonMember_FindMapper_NotList_Success()
        {
            MapperConfigurationTestContainer expected = new MapperConfigurationTestContainer();

            ExpressionMapper.Reset();
            ExpressionMapper.CreateMap <ClassSource2, ClassDest2>();

            expected.CreateMappingExpression(null);
            var actual = expected.GetGenericLambdaExpression();

            ExpressionMapper.Reset();
        }
        public void CheckAndConfigureMappingTest_List_SameType_Success()
        {
            ExpressionMapper.Reset();
            ExpressionMapper.CreateMap <ClassSource2, ClassDest2>();

            MapperConfigurationTestContainer expected = new MapperConfigurationTestContainer();

            MapperConfigurationCollectionContainer.Instance.Add(expected);
            ExpressionMapper.Initialize();
            Expression <Func <ClassSource, object> >     source = s => s.ListString;
            Expression <Func <ClassDest, object> >       target = d => d.ListString;
            Tuple <Expression, Expression, bool, string> tuple  = Tuple.Create(source.Body, target.Body, false, string.Empty);

            expected.CheckAndConfigureMappingTest(tuple);
            Assert.IsNotNull(expected.GetDelegate());
        }
Пример #7
0
 private static void Clean()
 {
     ExpressionMapper.Reset();
 }
 public static void Clean()
 {
     ExpressionMapper.Reset();
 }