コード例 #1
0
        public void MapperProperties()
        {
            var testModelC = new TestModelC()
            {
                PropertyString   = "PropertyString",
                PropertyInt      = 100,
                PropertyDateTime = DateTime.Now,
                PropertyDecimal  = 1991.0504M
            };
            var testModelC_1 = MapperHelper.MapperProperties <TestModelC, TestModelC_1>(testModelC);

            Assert.Equal(testModelC.PropertyString, testModelC_1.PropertyString);
            Assert.Equal(testModelC.PropertyInt, testModelC_1.PropertyInt);
            Assert.Equal(testModelC.PropertyDecimal, testModelC_1.PropertyDecimal);
            Assert.Equal(testModelC.PropertyDecimal, testModelC_1.PropertyDecimal);
        }
コード例 #2
0
        public void MapperPropertiesIntoDestination()
        {
            var testModelB = new TestModelB()
            {
                PropertyDateTime = DateTime.Now,
                PropertyDecimal  = 1991.0504M
            };
            var testModelC = new TestModelC()
            {
                PropertyString = "PropertyString",
                PropertyInt    = 100
            };

            testModelC = MapperHelper.MapperSourcePropertiesIntoDestination(testModelB, testModelC);
            Assert.Equal("PropertyString", testModelC.PropertyString);
            Assert.Equal(100, testModelC.PropertyInt);
            Assert.Equal(testModelB.PropertyDecimal, testModelC.PropertyDecimal);
            Assert.Equal(testModelB.PropertyDecimal, testModelC.PropertyDecimal);
        }