public When_mapping_a_data_reader_to_a_dto_and_the_map_does_not_exist() { var config = new MapperConfiguration(cfg => MapperRegistry.Mappers.Insert(0, new DataReaderMapper())); _mapper = config.CreateMapper(); _dataReader = new DataBuilder().BuildDataReader(); }
public When_mapping_a_data_reader_to_a_dto_with_nullable_enum() { _config = new MapperConfiguration(cfg => { MapperRegistry.Mappers.Insert(0, new DataReaderMapper()); cfg.CreateMap <IDataReader, DtoWithSingleNullableField>(); }); _dataReader = new DataBuilder().BuildDataReaderWithNullableField(); }
public When_mapping_a_data_reader_to_a_dto_twice() { //var mapper = new MapperConfiguration(cfg => //{ // MapperRegistry.Mappers.Insert(0, new DataReaderMapper()); //}).CreateMapper(); DataReader = new DataBuilder().BuildDataReader(); Results = _mapper.Map <IDataReader, IEnumerable <DTOObject> >(DataReader); Result = Results.FirstOrDefault(); }
public When_mapping_a_data_reader_to_a_dto_with_nested_dto() { var config = new MapperConfiguration(cfg => { MapperRegistry.Mappers.Insert(0, new DataReaderMapper()); cfg.CreateMap <IDataReader, DtoWithNestedClass>(); }); _dataReader = new DataBuilder().BuildDataReaderWithNestedClass(); _mapper = config.CreateMapper(); }
public When_mapping_a_single_data_record_to_a_dto() { _config = new MapperConfiguration(cfg => { MapperRegistry.Mappers.Insert(0, new DataReaderMapper()); cfg.CreateMap <IDataRecord, DTOObject>() .ForMember(dest => dest.Else, options => options.MapFrom(src => src.GetDateTime(src.GetOrdinal(FieldName.Something)))); }); var mapper = _config.CreateMapper(); _dataRecord = new DataBuilder().BuildDataRecord(); _result = mapper.Map <IDataRecord, DTOObject>(_dataRecord); }
public When_mapping_a_data_reader_to_a_dto() { _config = new MapperConfiguration(cfg => { MapperRegistry.Mappers.Insert(0, new DataReaderMapper { YieldReturnEnabled = YieldReturnEnabled }); cfg.CreateMap <IDataReader, DTOObject>() .ForMember(dest => dest.Else, options => options.MapFrom(src => src.GetDateTime(10))); cfg.CreateMissingTypeMaps = true; }); _mapper = _config.CreateMapper(); DataReader = new DataBuilder().BuildDataReader(); Results = _mapper.Map <IDataReader, IEnumerable <DTOObject> >(DataReader); Result = Results.FirstOrDefault(); }