public void Map_WithCustomRules() { var source = new PolymorphicModel { MyValue = new PolymorphicValueC { Y = "TheY", } }; var actual = _mapper.Map <PolymorphicDto>(source); var asPolymorphicValueCDto = actual.MyValue as PolymorphicValueCDto; Assert.NotNull(asPolymorphicValueCDto); Assert.Equal("TheY-custom", asPolymorphicValueCDto.Y); }
public void Map_WithPolymorphicValueB_ShouldMapPolymorphicValueBDto() { var source = new PolymorphicModel { MyValue = new PolymorphicValueB { Y = "TheY", Z = "TheZ", } }; var actual = _mapper.Map <PolymorphicDto>(source); var asPolymorphicValueBDto = actual.MyValue as PolymorphicValueBDto; Assert.NotNull(asPolymorphicValueBDto); Assert.Equal("TheY", asPolymorphicValueBDto.Y); Assert.Equal("TheZ", asPolymorphicValueBDto.Z); }