public void CreateText_RootLevelOnlyMapped() { var config = new HappyConfig(cfg => { cfg.CreateMap <A, B>(); }); var typeMaps = config.TypeMaps; foreach (var kvp in typeMaps) { TypePair typePair = kvp.Key; TypeMap map = kvp.Value; var mtb = new MethodInnerCodeBuilder(typeMaps, config.Configuration); string text = mtb.GetAssignment(map).RelativeTemplate; Console.WriteLine(typePair.ToString()); Console.WriteLine(text); Console.WriteLine(); } }
public void CreateText_IgnoreAtSubLevel() { var config = new HappyConfig(cfg => { cfg.CreateMap <A, B>(); cfg.CreateMap <A1, B1>().ForMember(d => d.Id, opt => opt.Ignore()); cfg.CreateMap <A2, B2>(); }); var typeMaps = config.TypeMaps; var mtb = new MethodInnerCodeBuilder(typeMaps, config.Configuration); foreach (var kvp in typeMaps) { TypePair typePair = kvp.Key; TypeMap map = kvp.Value; string text = mtb.GetAssignment(map).RelativeTemplate; Console.WriteLine(typePair.ToString()); Console.WriteLine(text); Console.WriteLine(); } }