public void Mapped_Complex_chile_when_null() { var source = new SourceMapWithComplexChield { Id = 1 }; IMapper <SourceMapWithComplexChield, DestMapWithComplexChield> mapper = new MapperWithComplexChild(); var result = mapper.Map(source); result.IdMapped.Should().Be(source.Id); result.ChildMapped.Should().BeNull(); }
public void Mapp_complex_child() { var source = new SourceMapWithComplexChield { Id = 1, Child = new SourceChield { Name = "1Child" } }; IMapper <SourceMapWithComplexChield, DestMapWithComplexChield> mapper = new MapperWithComplexChild(); var result = mapper.Map(source); result.IdMapped.Should().Be(source.Id); result.ChildMapped.NameMapped.Should().Be(source.Child.Name); }
public void Complex_child_collection_wtith_manual_map() { var source = new SourceMapWithComplexChield { Id = 1, ChildList = new List <SourceChield> { new SourceChield { Name = "1SourceChild" }, new SourceChield { Name = "2SourceChild" }, } }; IMapper <SourceMapWithComplexChield, DestMapWithComplexChield> mapper = new MapperWithComplexChild(); var result = mapper.Map(source); result.ChildListMap.Should().HaveCount(source.ChildList.Count); //result.ChildListMap.Join<DestChield, SourceChield, string,>(source, x => x.NameMapped, xx => xx.Name, x => new DestChield { NameMapped = x.NameMapped }); }