public void TestNotificationAboutSingleProperty() { Expression <Func <TestableNotificationObject, int> > expr = _ => _.TestProperty; PropertyChangedEventArgs e = null; var no = new TestableNotificationObject(); no.PropertyChanged += (sender, e2) => e = e2; no.InvokeRaisePropertyChanged(expr); Assert.AreNotEqual(null, e); Assert.AreEqual(PropertyExpressionHelper.GetName(expr), e.PropertyName); }
/// <summary> /// Raises the <see cref="PropertyChanged"/> event. /// </summary> /// <typeparam name="TClass">The type of object which property has a new value.</typeparam> /// <typeparam name="TProperty">The type of the property that has a new value.</typeparam> /// <param name="propertyExpression">A Lambda expression representing the property that has a new value.</param> protected void RaisePropertyChanged <TClass, TProperty>(Expression <Func <TClass, TProperty> > propertyExpression) { this.InternalRaisePropertyChanged(PropertyExpressionHelper.GetName(propertyExpression)); }