예제 #1
0
        public void MapFromTest()
        {
            var currentDate = DateTime.Now;

            var objC = new ConfigC()
            {
                BirthDate = currentDate,
                Id        = 1,
                Name      = "Timuçin",
                Surname   = "KIVANÇ"
            };

            TypeAdapterConfig <ConfigC, ConfigD> .NewConfig()
            //.Map(dest => dest.FullName, (src) => string.Concat(src.Name, " ", src.Surname));
            .Map(dest => dest.FullName, src => string.Concat(src.Name, " ", src.Surname));

            var objD = TypeAdapter.Adapt <ConfigC, ConfigD>(objC);

            Assert.IsNotNull(objD);

            Assert.IsTrue(objD.Id == 1 && objD.FullName == "Timuçin KIVANÇ" && objD.BirthDate == currentDate);
        }
예제 #2
0
        public void MapFromTest()
        {
            var currentDate = DateTime.Now;

            var objC = new ConfigC()
            {
                BirthDate = currentDate,
                Id = 1,
                Name = "Timuçin",
                Surname = "KIVANÇ"
            };

            TypeAdapterConfig<ConfigC, ConfigD>.NewConfig()
                //.Map(dest => dest.FullName, (src) => string.Concat(src.Name, " ", src.Surname));
                .Map(dest => dest.FullName, src => string.Concat(src.Name, " ", src.Surname));

            var objD = TypeAdapter.Adapt<ConfigC, ConfigD>(objC);

            Assert.IsNotNull(objD);

            Assert.IsTrue(objD.Id == 1 && objD.FullName == "Timuçin KIVANÇ" && objD.BirthDate == currentDate);
        }