public static void ExtractPropertyName_WithTypedProperty()
        {
            Expression <Func <Person, int> > exp;

            exp = me => me.Age;

            var propName = ExpressionPropertyAnalyzer.ExtractPropertyName(exp);

            Assert.AreEqual("Age", propName);
        }
        public static void ExtractPropertyName_WithMultiStepConvertProperty()
        {
            Expression <Func <Person, object> > exp;

            exp = me => me.Brother.Age;

            var propName = ExpressionPropertyAnalyzer.ExtractPropertyName(exp);

            Assert.AreEqual("Age", propName);
        }
        public static BridgeMethod <T> Create <TResult>(Expression <Func <T, TResult> > propertyAccessor)
        {
            MemberExpression memberExpression = ExpressionPropertyAnalyzer.UnwrapLambda(propertyAccessor);

            if (!(memberExpression.Expression is ParameterExpression))
            {
                throw new InvalidOperationException("Extended Properties are not allowed.");
            }

            var name = ExpressionPropertyAnalyzer.ExtractPropertyName(propertyAccessor);

            Action <T> changedCallback  = me => me.OnPropertyChanged(name);
            Action <T> changingCallback = me => me.OnPropertyChanging(name);

            var method = new BridgeMethod <T>(changingCallback, changedCallback);

            return(method);
        }