コード例 #1
0
ファイル: ForTests.cs プロジェクト: Sufflavus/TinyMapper
        public void Test()
        {
            TinyMapper.Bind<Source, Target>(config => config.Bind(from => @from.Campaign, typeof(Campaign1)));

            var source = new Source
            {
                Campaign = new Campaign1
                {
                    Value = 1
                }
            };

            var result = TinyMapper.Map<Target>(source);
        }
コード例 #2
0
        public void Map_Hierarchy_Success()
        {
            TinyMapper.Bind<Source, Target>();

            var source = new Source
            {
                Id = 1,
                String = "tiny"
            };

            var actual = TinyMapper.Map<Target>(source);

            Assert.Equal(source.Id, actual.Id);
            Assert.Equal(source.String, actual.String);
        }
コード例 #3
0
ファイル: ForTests.cs プロジェクト: qihangnet/TinyMapper
        public void Test()
        {
            var source = new Source
            {
                MyInt = 1,
                MyString = "My Value"
            };

            TinyMapper.Bind<Source, Target>(config =>
            {
                config.Bind(from => from.MyInt, to => to.Int);
                config.Bind(from => from.MyString, to => to.MyString);
            });

            var target = TinyMapper.Map<Target>(source);
        }