Esempio n. 1
0
        public void CopyPropertiesIfNameTypeAndValueTypeMatches()
        {
            //Arrange
            var source = new SomeSource
            {
                SamePropNameNotPrimitiveValueType = (decimal)1.2
            };
            var target = new SomeTarget();

            //Act
            SimplePropertyMapper.Map(source, target);

            //Assert
            Assert.AreEqual(source.SamePropNameNotPrimitiveValueType, target.SamePropNameNotPrimitiveValueType);
        }
Esempio n. 2
0
        public void DoNotCopyPropertiesIfNamesMismatch()
        {
            //Arrange
            var source = new SomeSource
            {
                SomeProp1 = "Test String"
            };

            var target = new SomeTarget();

            //Act
            SimplePropertyMapper.Map(source, target);

            //Assert
            Assert.AreNotEqual(source.SomeProp1, target.DbProp1);
        }
Esempio n. 3
0
        public void DoNotCopyPropertiesIfTypesAreNotPrimitiveOrInTheAllowedTypesList()
        {
            //Arrange
            var source = new SomeSource
            {
                SomeComplexType = (object)("TEST complex type")
            };

            var target = new SomeTarget();

            //Act
            SimplePropertyMapper.Map(source, target);

            //Assert
            Assert.AreNotEqual(source.SomeComplexType, target.SomeComplexType);
        }
Esempio n. 4
0
        public void DoNotCopyPropertiesIfTypesMismatch()
        {
            //Arrange
            var source = new SomeSource
            {
                SameNameDifferentType = "Test String"
            };

            var target = new SomeTarget();

            //Act
            SimplePropertyMapper.Map(source, target);

            //Assert
            Assert.AreNotEqual(source.SameNameDifferentType, target.SameNameDifferentType);
        }