コード例 #1
0
        public void Map()
        {
            TypeAdapterConfig.GlobalSettings.Clear();
            TypeAdapterConfig.GlobalSettings.NewConfig <SourceClass, DestClass>()
            .IgnoreNullValues(true)
            .Compile();

            var source = new SourceClass();
            var dest   = source.Adapt <DestClass>();

            Assert.AreEqual("Hello", dest.Title);
            Assert.IsNotNull(dest.Sub);
            Assert.IsNotNull(dest.List);
        }
コード例 #2
0
        public void Map()
        {
            TypeAdapterConfig.GlobalSettings.Clear();
            TypeAdapterConfig.GlobalSettings.NewConfig<SourceClass, DestClass>()
                .IgnoreNullValues(true)
                .Compile();

            var source = new SourceClass();
            var dest = source.Adapt<DestClass>();

            Assert.AreEqual("Hello", dest.Title);
            Assert.NotNull(dest.Sub);
            Assert.NotNull(dest.List);
        }