Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
        public void MapperTwoClassPropertiesTest()
        {
            var testModelA = new TestModelA()
            {
                PropertyString = "PropertyString",
                PropertyInt    = 100
            };

            var testModelB = new TestModelB()
            {
                PropertyDateTime = DateTime.Now,
                PropertyDecimal  = 1991.0504M
            };

            var testModelC = MapperHelper.MapperTwoClassProperties <TestModelA, TestModelB, TestModelC>(testModelA, testModelB);

            Assert.Equal(testModelC.PropertyString, testModelA.PropertyString);
            Assert.Equal(testModelC.PropertyInt, testModelA.PropertyInt);
            Assert.Equal(testModelC.PropertyDecimal, testModelB.PropertyDecimal);
            Assert.Equal(testModelC.PropertyDecimal, testModelB.PropertyDecimal);
        }