Example #1
0
        public static void TinyMapperTest()
        {
            TinyMapper.Bind <Park, Park>();
            TinyMapper.Bind <Customer, CustomerDTO>();
            TinyMapper.Bind <Dictionary <String, String>, Building>();

            var customer  = Customer.Create();
            var customer1 = TinyMapper.Map(customer, new CustomerDTO());

            var p1 = Park.Create();
            var p2 = TinyMapper.Map <Park>(p1);//p2.Cars.Count = 0 is unexpected.Collection element does not copied to property with private setter.

            var d = new Dictionary <String, String>();

            d["Name"] = "B1";
            var b3 = TinyMapper.Map <Building>(d);//Does not map...


            return;

            //StackOverflowException thrown
            TinyMapper.Bind <TreeNode, TreeNode>();
            TinyMapper.Bind <TreeNode, TreeNodeTarget>();

            var tn  = TreeNode.Create();
            var tn2 = TinyMapper.Map <TreeNode>(tn);
        }
Example #2
0
        public static void HigLaboMapperTest()
        {
            var config = ObjectMapConfig.Current;

            var b1 = new Building();
            var b2 = config.Map(b1, new Building());

            var tn  = TreeNode.Create();
            var tn2 = config.Map(tn, new TreeNode());

            var p1 = Park.Create();
            var p2 = config.Map(p1);
        }
Example #3
0
        public static void MapsterTest()
        {
            var p1 = Park.Create();
            var p2 = Mapster.TypeAdapter.Adapt <Park>(p1);//p2.Cars.Count = 0 is unexpected.Collection element does not copied to property with private setter.

            var d = new Dictionary <String, String>();

            d["Name"] = "B1";
            var b3 = Mapster.TypeAdapter.Adapt <Building>(d);//Does not map...

            return;

            //StackOverflowException thrown
            var tn  = TreeNode.Create();
            var tn2 = Mapster.TypeAdapter.Adapt <TreeNode>(tn);
        }
Example #4
0
        public static void AgileMapperTest()
        {
            var p1 = Park.Create();
            var p2 = AgileObjects.AgileMapper.Mapper.Map <Park>(p1).ToANew <Park>();//p2.Cars.Count = 0 is unexpected.Collection element does not copied to property with private setter.

            var d = new Dictionary <String, String>();

            d["Name"] = "B1";
            var b3 = AgileObjects.AgileMapper.Mapper.Map <Dictionary <String, String> >(d).ToANew <Building>();//Does not map...

            return;

            //StackOverflowException thrown
            var tn  = TreeNode.Create();
            var tn2 = AgileObjects.AgileMapper.Mapper.Map <TreeNode>(tn).ToANew <TreeNode>();//Does not map...
        }
Example #5
0
        public static void AutoMapperTest()
        {
            _AutoMapperConfiguration = new AutoMapper.MapperConfiguration(config => {
                config.CreateMap <Building, Building>();
                config.CreateMap <TreeNode, TreeNode>();
            });
            var mapper = _AutoMapperConfiguration.CreateMapper();
            var b1     = new Building();
            var b2     = mapper.Map <Building>(b1);

            var p1 = Park.Create();
            var p2 = mapper.Map <Park>(p1);

            var tn  = TreeNode.Create();
            var tn2 = mapper.Map <TreeNode>(tn);
        }
Example #6
0
        public static void FastMapperTest()
        {
            var p1 = Park.Create();
            var p2 = FastMapper.TypeAdapter.Adapt <Park, Park>(p1);//p2.Cars.Count = 0 is unexpected.Collection element does not copied to property with private setter.

            //StackOverflowException thrown
            var tn  = TreeNode.Create();
            var tn2 = FastMapper.TypeAdapter.Adapt <TreeNode>(tn);//tn2.Nodes.Count = 0.

            var c1 = Car.Create();
            var c2 = FastMapper.TypeAdapter.Adapt <Car, Car>(c1);//Exception!

            var d = new Dictionary <String, String>();

            d["Name"] = "B1";
            var b3 = FastMapper.TypeAdapter.Adapt <Building>(d);//Does not map...
        }
Example #7
0
        public static void ExpressMapperTest()
        {
            var p1 = Park.Create();
            var p2 = ExpressMapper.Mapper.Map <Park, Park>(p1);//p2.Cars.Count = 0 is unexpected.Collection element does not copied to property with private setter.

            var c1 = Car.Create();
            var c2 = ExpressMapper.Mapper.Map <Car, Car>(c1);//Exception!

            var d = new Dictionary <String, String>();

            d["Name"] = "B1";
            var b3 = ExpressMapper.Mapper.Map <Dictionary <String, String>, Building>(d);//Does not map...

            return;

            var tn  = TreeNode.Create();
            var tn2 = ExpressMapper.Mapper.Map <TreeNode, TreeNode>(tn);//tn2.Nodes.Count = 0.
        }
Example #8
0
        public static void AutoMapperTest()
        {
            AutoMapper.Mapper.Initialize(config =>
            {
                config.CreateMap <Building, Building>();
                config.CreateMap <TreeNode, TreeNode>();
            });

            var b1 = new Building();
            var b2 = AutoMapper.Mapper.Map <Building>(b1);

            var p1 = Park.Create();
            var p2 = AutoMapper.Mapper.Map <Park>(p1);

            return;

            //StackOverflowException thrown
            var tn  = TreeNode.Create();
            var tn2 = AutoMapper.Mapper.Map <TreeNode>(tn);
        }