public void ReversivePropertyMap_GoodValues_Succeeds()
        {
            //Arrange
            var propertyInfo = ReflectionHelper.GetMemberInfo<string, int>((string s) => s.Length) as PropertyInfo;

            //Act
            var reversivePropertyMap = new ReversivePropertyMap(propertyInfo);

            //Assert
            Assert.AreEqual<string>("Length", reversivePropertyMap.SourcePropertyInfo.Name);
        }
        public void ToString_Always_Succeeds()
        {
            //Arrange
            var propertyInfo = ReflectionHelper.GetMemberInfo<string, int>((string s) => s.Length) as PropertyInfo;

            //Act
            var reversivePropertyMap = new ReversivePropertyMap(propertyInfo);

            //Assert
            var actual = reversivePropertyMap.ToString();
            Assert.AreEqual<string>(string.Format("{{{0}, {1}}}", propertyInfo.Name, propertyInfo.ReflectedType), actual);
        }
Example #3
0
        public static void MapValidationException_IfPropertyMapperOrPropertyUnMapperIsNotDefined(
			TypeMapBase typeMap, ReversivePropertyMap propertyMap)
        {
            if ((propertyMap.Mapper == null && propertyMap.UnMapper != null)
                || (propertyMap.Mapper != null && propertyMap.UnMapper == null))
            {
                throw new MapValidationException(string.Format(Resources.PropertyMapperOrPropertyUnMapperIsNotDefined2,
                    (propertyMap != null)
                    ? propertyMap.ToString()
                    : string.Empty, (typeMap != null)
                        ? typeMap.ToString()
                        : string.Empty), null);
            }
        }