Beispiel #1
0
        public void CoreTestSimpleObjectWithExclude()
        {
            var source = MultipleSets.Create(5);
            var myDTO  = Mapper.MapExclude <MultipleSets, DTO.MultipleSets>(source, x => x.SimpleClasses.Select(y => y.IntArray));
            var manual = new DTO.MultipleSets(source);

            manual.SimpleClasses.ForEach(x => x.IntArray = null);

            Assert.Equal(myDTO, manual);
        }
Beispiel #2
0
        public void CoreTestSimpleObjectWithNoInclude()
        {
            var source = MultipleSets.Create(5);
            var myDTO  = Mapper.Map <MultipleSets, DTO.MultipleSets>(source, null);

            var manual = new DTO.MultipleSets()
            {
                Id = source.Id
            };

            Assert.Equal(myDTO, manual);
        }
Beispiel #3
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);
        }