PropertyChangedAssertionsRaised_PropertyChangedT Method (SmartAssertPlaceHolder, ExpressionFuncT) |
Namespace: SmartTests.Assertions
public static Assertion Raised_PropertyChanged<T>( this SmartAssertPlaceHolder _, Expression<Func<T>> expression )
Exception | Condition |
---|---|
BadTestException | If expression is not a MemberExpression with a property. If the involved instance of expression is not an INotifyPropertyChanged instance. If the member is not a Property. |
SmartTestException | If the INotifyPropertyChanged event is not raised. If PropertyName is not the name of the property/indexer in the Act. |
Nothing special.
Ensures the PropertyChanged event is raised.
The PropertyName is the one in the Act; otherwise a SmartTestException is thrown.
If the event was not raised, a SmartTestException is thrown.
In this example, the Smart Assertion verifies that the PropertyChanged event is raised for the property MyProperty.
[Test] public void MyMethodTest() { var mc = new MyClass(); RunTest( ValidValue.IsValid, () => mc.MyMethod(), SmartAssert.Raised_PropertyChanged( () => mc.MyProperty ) ); }