예제 #1
0
        public void Unflattening()
        {
            var dto = new OrderDto()
            {
                CustomerName = "Johnny",
            };

            dto.SetProductName("Mobile phone");

            var mapper = new Mapper(cfg =>
            {
                cfg.Conventions.GetOrAdd <ProjectionConvention>();
            });

            //TODO: we need to create instances for nested objects!!!
            var order = mapper.Map <Order>(dto);

            Assert.IsTrue(dto.CustomerName == order.Customer.Name);
            Assert.IsTrue(dto.GetProductName() == order.Product.Name);
        }