public void Map_PrimitiveTypes_Success(Type sourceType, Type targetType, object source, object expected)
 {
     var builder = new ConvertibleTypeMapperBuilder(new MappingBuilderConfigStub());
     Mapper mapper = builder.Build(new TypePair(sourceType, targetType));
     object actual = mapper.Map(source);
     Assert.Equal(expected, actual);
 }
Exemplo n.º 2
0
        public TargetMapperBuilder(IDynamicAssembly assembly)
        {
            Assembly = assembly;

            _classMapperBuilder = new ClassMapperBuilder(this);
            _collectionMapperBuilder = new CollectionMapperBuilder(this);
            _convertibleTypeMapperBuilder = new ConvertibleTypeMapperBuilder(this);
        }
        public void Map_Enum_Success(object source, object expected)
        {
            var builder = new ConvertibleTypeMapperBuilder(new MappingBuilderConfigStub());
            Mapper mapper = builder.Build(new TypePair(typeof(EnumA), typeof(EnumB)));

            var actual = (EnumB)mapper.Map(source);
            Assert.Equal((EnumB)(expected), actual);
        }
        public void Map_Enum_Success()
        {
            var builder = new ConvertibleTypeMapperBuilder(new MappingBuilderConfigStub());
            Mapper mapper = builder.Build(new TypePair(typeof(EnumA), typeof(EnumB)));

            var actual = (EnumB)mapper.Map(EnumA.B);
            Assert.Equal(EnumB.B, actual);
        }