PropertyChangedAssertionsRaised_PropertyChanged Method (SmartAssertPlaceHolder) |
Namespace: SmartTests.Assertions
Exception | Condition |
---|---|
BadTestException | If the instance is null or the property/indexer cannot be inferred from the Act. If the value of the property before the Act is the value involved in the Act. |
SmartTestException | If the INotifyPropertyChanged event is not raised. If PropertyName is not the involved property in Act. If the current value of the property is not the involved value in Act during the Act or after the Act. |
The value of the property/indexer IS NOT the value of the Act; otherwise a BadTestException is thrown.
Ensures the PropertyChanged event is raised.
The PropertyName is the name of the property of the Act; otherwise a SmartTestException is thrown.
The value of the property/indexer in the PropertyChanged handler is the one involved in the Act; otherwise a SmartTestException is thrown.
If the event was not raised, a SmartTestException is thrown.
The value of the property/indexer is the one involved in the Act; otherwise a SmartTestException is thrown.
In this example, the Smart Assertion verifies that the PropertyChanged event is raised for the property MyProperty and the value is 10.
It also ensures that the value is still 10 after the Act.
[Test] public void MyMethodTest() { var mc = new MyClass(); RunTest( ValidValue.IsValid, Assign( () => mc.MyProperty, 10 ), SmartAssert.Raised_PropertyChanged() ); }