public void ExpandWithCustomMapping()
        {
            var mapper = FluentMapper.ThatMaps<Target>().From<MismatchSource>()
                .ThatExpandsInto(tgt => tgt.Nested)
                    .UsingMapping(spec => spec
                        .ThatSets(tgt => tgt.OtherProp).From(src => src.Prop))
                .Create();

            var source = new MismatchSource();
            var result = mapper.Map(source);

            Assert.That(result.Thing, Is.EqualTo(source.Thing));
            Assert.That(result.Nested.OtherProp, Is.EqualTo(source.Prop));
        }
Example #2
0
        public void ExpandWithCustomMapping()
        {
            var mapper = FluentMapper.ThatMaps <Target>().From <MismatchSource>()
                         .ThatExpandsInto(tgt => tgt.Nested)
                         .UsingMapping(spec => spec
                                       .ThatSets(tgt => tgt.OtherProp).From(src => src.Prop))
                         .Create();

            var source = new MismatchSource();
            var result = mapper.Map(source);

            Assert.That(result.Thing, Is.EqualTo(source.Thing));
            Assert.That(result.Nested.OtherProp, Is.EqualTo(source.Prop));
        }