示例#1
0
        public void CoreTestTargetAsInterface()
        {
            var source = SimpleClass.Create(5);
            var myDTO  = Mapper.Map <SimpleClass, DTO.ISimpleClass>(source);
            var manual = new DTO.SimpleClass(source);

            Assert.Equal(myDTO, manual);
        }
示例#2
0
        public void CoreTestSimpleObjectWithInclude()
        {
            var source = MultipleSets.Create(5);
            var myDTO  = Mapper.Map <MultipleSets, DTO.MultipleSets>(source, x => x.SimpleClasses.Select(y => y.IntArray), x => x.IntegerSet);

            var manual = new DTO.MultipleSets()
            {
                Id            = source.Id,
                IntegerSet    = new HashSet <int>(source.IntegerSet),
                SimpleClasses = source.SimpleClasses.Select(p => { var res = new DTO.SimpleClass(p); res.VerySimpleClass = null; return(res); }).ToList()
            };

            Assert.Equal(myDTO, manual);
        }